Skip to content

Commit 5c283e6

Browse files
authored
Build script enhancements, use gradle to build images where possible (#48)
- Use Gradle instead of dockerfiles for SCCS, Eureka and SBA - Always get version info from metadata files - Catch errors during build/patch process - Pass more properties to Initializr - Add special behavior for local names/tags - Convert all .adoc to .md Server-specific updates: - Config Server: remove spring.config.name override - Eureka: use lazy-initialization to improve start time - SBA: Enable AoT and disable checking for thymeleaf templates
1 parent b5407a0 commit 5c283e6

34 files changed

+447
-372
lines changed

.github/workflows/build_config_server.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,14 @@ on:
77
paths:
88
- '.github/workflows/build_config_server.yaml'
99
- 'config-server/**'
10+
- 'build.ps1'
1011
push:
1112
branches:
1213
- main
1314
paths:
1415
- '.github/workflows/build_config_server.yaml'
1516
- 'config-server/**'
17+
- 'build.ps1'
1618

1719
concurrency:
1820
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
@@ -37,7 +39,7 @@ jobs:
3739
run: ./build.ps1 -Name '${{ env.IMAGE_NAME }}' -Registry '${{ env.REGISTRY }}' -Tag '${{ env.TAG }}'
3840
shell: pwsh
3941
env:
40-
TAG: ${{ github.event_name == 'pull_request' && format('-t {0}/{1}:pr-{2}', env.REGISTRY, env.IMAGE_NAME, github.event.number) || '' }}
42+
TAG: ${{ github.event_name == 'pull_request' && format('pr-{0}', github.event.number) || '' }}
4143

4244
- name: Login to container registry
4345
uses: docker/login-action@v3

.github/workflows/build_eureka_server.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,14 @@ on:
77
paths:
88
- '.github/workflows/build_eureka_server.yaml'
99
- 'eureka-server/**'
10+
- 'build.ps1'
1011
push:
1112
branches:
1213
- main
1314
paths:
1415
- '.github/workflows/build_eureka_server.yaml'
1516
- 'eureka-server/**'
17+
- 'build.ps1'
1618

1719
concurrency:
1820
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
@@ -37,7 +39,7 @@ jobs:
3739
run: ./build.ps1 -Name '${{ env.IMAGE_NAME }}' -Registry '${{ env.REGISTRY }}' -Tag '${{ env.TAG }}'
3840
shell: pwsh
3941
env:
40-
TAG: ${{ github.event_name == 'pull_request' && format('-t {0}/{1}:pr-{2}', env.REGISTRY, env.IMAGE_NAME, github.event.number) || '' }}
42+
TAG: ${{ github.event_name == 'pull_request' && format('pr-{0}', github.event.number) || '' }}
4143

4244
- name: Login to container registry
4345
uses: docker/login-action@v3

.github/workflows/build_springboot_admin_server.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,14 @@ on:
77
paths:
88
- '.github/workflows/build_springboot_admin_server.yaml'
99
- 'spring-boot-admin/**'
10+
- 'build.ps1'
1011
push:
1112
branches:
1213
- main
1314
paths:
1415
- '.github/workflows/build_springboot_admin_server.yaml'
1516
- 'spring-boot-admin/**'
17+
- 'build.ps1'
1618

1719
concurrency:
1820
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
@@ -37,7 +39,7 @@ jobs:
3739
run: ./build.ps1 -Name '${{ env.IMAGE_NAME }}' -Registry '${{ env.REGISTRY }}' -Tag '${{ env.TAG }}'
3840
shell: pwsh
3941
env:
40-
TAG: ${{ github.event_name == 'pull_request' && format('-t {0}/{1}:pr-{2}', env.REGISTRY, env.IMAGE_NAME, github.event.number) || '' }}
42+
TAG: ${{ github.event_name == 'pull_request' && format('pr-{0}', github.event.number) || '' }}
4143

4244
- name: Login to container registry
4345
uses: docker/login-action@v3

.github/workflows/build_uaa_server.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,14 @@ on:
77
paths:
88
- '.github/workflows/build_uaa_server.yaml'
99
- 'uaa-server/**'
10+
- 'build.ps1'
1011
push:
1112
branches:
1213
- main
1314
paths:
1415
- '.github/workflows/build_uaa_server.yaml'
1516
- 'uaa-server/**'
17+
- 'build.ps1'
1618

1719
concurrency:
1820
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
@@ -37,7 +39,7 @@ jobs:
3739
run: ./build.ps1 -Name '${{ env.IMAGE_NAME }}' -Registry '${{ env.REGISTRY }}' -Tag '${{ env.TAG }}'
3840
shell: pwsh
3941
env:
40-
TAG: ${{ github.event_name == 'pull_request' && format('-t {0}/{1}:pr-{2}', env.REGISTRY, env.IMAGE_NAME, github.event.number) || '' }}
42+
TAG: ${{ github.event_name == 'pull_request' && format('pr-{0}', github.event.number) || '' }}
4143

4244
- name: Login to container registry
4345
uses: docker/login-action@v3

.gitignore

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
# IntelliJ
1+
# IDEs
22
.idea/
3+
.vscode/
4+
.vs/
35

46
# Vi/Vim
57
*.swp
@@ -10,3 +12,6 @@ build/
1012

1113
# MacOS
1214
.DS_Store
15+
16+
# Staging directory
17+
workspace/

README.adoc

Lines changed: 0 additions & 55 deletions
This file was deleted.

README.md

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# SteeltoeOSS Docker Images
2+
3+
GitHub repo for server images to use for local development with SteeltoeOSS.
4+
5+
## Building
6+
7+
### Pre-Requisites
8+
9+
The following tools are required to build any image in this repository:
10+
11+
1. PowerShell or pwsh
12+
1. Docker or Podman
13+
14+
#### Config Server, Eureka and Spring Boot Admin
15+
16+
The process for these images is to download starter projects from start.spring.io, apply patches to those files and produce images using [the Gradle Plugin](https://docs.spring.io/spring-boot/gradle-plugin/packaging-oci-image.html).
17+
To build these images you must also have:
18+
19+
1. Access to start.spring.io
20+
1. `patch` available in the path or installed with Git for Windows
21+
1. JDK 21
22+
23+
If you do not already have a JDK installed, consider using [Scoop](https://scoop.sh/):
24+
25+
```shell
26+
# Permit executing remote-signed scripts
27+
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
28+
# Install Scoop
29+
Invoke-RestMethod -Uri https://get.scoop.sh | Invoke-Expression
30+
# Add the Java bucket
31+
scoop bucket add java
32+
# Install the JDK
33+
scoop install java/openjdk21
34+
```
35+
36+
### Build a specific image
37+
38+
```shell
39+
./build.ps1 config-server
40+
```
41+
42+
## Running
43+
44+
### List the created images
45+
46+
```shell
47+
docker images
48+
```
49+
50+
See [Common Tasks](https://github.com/SteeltoeOSS/Samples/blob/main/CommonTasks.md/) for instructions on how to run the various docker images.
51+
52+
## Images
53+
54+
| Name | Description |
55+
| ---- | ----------- |
56+
| [steeltoe.azurecr.io/config-server](config-server/) | Spring Cloud Config Server |
57+
| [steeltoe.azurecr.io/eureka-server](eureka-server/) | Netflix Eureka Server |
58+
| [steeltoe.azurecr.io/spring-boot-admin](spring-boot-admin/) | Spring Boot Admin |
59+
| [steeltoe.azurecr.io/uaa-server](uaa-server/) | Cloud Foundry UAA Server |
60+
61+
## Debug Image Building
62+
63+
### Inspect Container Contents
64+
65+
Via [StackOverflow](https://stackoverflow.com/questions/32353055/how-to-start-a-stopped-docker-container-with-a-different-command/39329138#39329138), here are the commands to list files in a stopped container.
66+
67+
1. Find the id of the stopped container
68+
* `docker ps -a`
69+
1. Commit the stopped container to a new image: test_image.
70+
* `docker commit $CONTAINER_ID test_image`
71+
1. Run the new image in a new container with a shell.
72+
* `docker run -ti --entrypoint=sh test_image`

0 commit comments

Comments
 (0)