Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Spring Boot Admin pipeline, update SBA, Eureka and Config Server deps #36

Merged
merged 4 commits into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 10 additions & 14 deletions .github/workflows/build_config_server.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ concurrency:
cancel-in-progress: true

permissions:
contents: 'read'
contents: read

env:
IMAGE_NAME: config-server
REGISTRY: ${{ github.event_name == 'pull_request' && vars.DOCKER_REGISTRY || 'steeltoeoss' }}
REGISTRY: ${{ vars.DOCKER_REGISTRY }}

jobs:
build-push:
Expand All @@ -31,21 +31,17 @@ jobs:
- uses: actions/checkout@v4

- name: Build Image
run: ./build.ps1 -Name ${{ env.IMAGE_NAME }} -Registry ${{ env.REGISTRY }}
run: ./build.ps1 -Name '${{ env.IMAGE_NAME }}' -Registry '${{ env.REGISTRY }}' -Tag '${{ env.TAG }}'
shell: pwsh
env:
TAG: ${{ github.event_name == 'pull_request' && format('-t {0}/{1}:pr-{2}', env.REGISTRY, env.IMAGE_NAME, github.event.number) }}

- name: Login to private container registry
if: ${{ github.event_name == 'pull_request' }}
- name: Login to container registry
bart-vmware marked this conversation as resolved.
Show resolved Hide resolved
uses: docker/login-action@v3
with:
registry: "${{ vars.DOCKER_REGISTRY }}"
username: "${{ secrets.DOCKER_USERNAME }}"
password: "${{ secrets.DOCKER_PASSWORD }}"
- name: Login to Docker Hub
bart-vmware marked this conversation as resolved.
Show resolved Hide resolved
if: ${{ github.event_name != 'pull_request' }}
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
registry: ${{ vars.DOCKER_REGISTRY }}
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Push image
run: docker push --all-tags ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
24 changes: 10 additions & 14 deletions .github/workflows/build_eureka_server.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ concurrency:
cancel-in-progress: true

permissions:
contents: 'read'
contents: read

env:
IMAGE_NAME: eureka-server
REGISTRY: ${{ github.event_name == 'pull_request' && vars.DOCKER_REGISTRY || 'steeltoeoss' }}
REGISTRY: ${{ vars.DOCKER_REGISTRY }}

jobs:
build-push:
Expand All @@ -31,21 +31,17 @@ jobs:
- uses: actions/checkout@v4

- name: Build Image
run: ./build.ps1 -Name ${{ env.IMAGE_NAME }} -Registry ${{ env.REGISTRY }}
run: ./build.ps1 -Name '${{ env.IMAGE_NAME }}' -Registry '${{ env.REGISTRY }}' -Tag '${{ env.TAG }}'
shell: pwsh
env:
TAG: ${{ github.event_name == 'pull_request' && format('-t {0}/{1}:pr-{2}', env.REGISTRY, env.IMAGE_NAME, github.event.number) }}

- name: Login to private container registry
if: ${{ github.event_name == 'pull_request' }}
- name: Login to container registry
uses: docker/login-action@v3
with:
registry: "${{ vars.DOCKER_REGISTRY }}"
username: "${{ secrets.DOCKER_USERNAME }}"
password: "${{ secrets.DOCKER_PASSWORD }}"
- name: Login to Docker Hub
if: ${{ github.event_name != 'pull_request' }}
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
registry: ${{ vars.DOCKER_REGISTRY }}
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Push image
run: docker push --all-tags ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
47 changes: 47 additions & 0 deletions .github/workflows/build_springboot_admin_server.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Build Spring Boot Admin Server

on:
pull_request:
branches:
- main
paths:
- 'spring-boot-admin/**'
push:
branches:
- main
paths:
- 'spring-boot-admin/**'

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

permissions:
contents: read

env:
IMAGE_NAME: spring-boot-admin
REGISTRY: ${{ vars.DOCKER_REGISTRY }}

jobs:
build-push:
name: Build and push image
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Build Image
run: ./build.ps1 -Name '${{ env.IMAGE_NAME }}' -Registry '${{ env.REGISTRY }}' -Tag '${{ env.TAG }}'
shell: pwsh
env:
TAG: ${{ github.event_name == 'pull_request' && format('-t {0}/{1}:pr-{2}', env.REGISTRY, env.IMAGE_NAME, github.event.number) }}

- name: Login to container registry
uses: docker/login-action@v3
with:
registry: ${{ vars.DOCKER_REGISTRY }}
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Push image
run: docker push --all-tags ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
24 changes: 10 additions & 14 deletions .github/workflows/build_uaa_server.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ concurrency:
cancel-in-progress: true

permissions:
contents: 'read'
contents: read

env:
IMAGE_NAME: uaa-server
REGISTRY: ${{ github.event_name == 'pull_request' && vars.DOCKER_REGISTRY || 'steeltoeoss' }}
REGISTRY: ${{ vars.DOCKER_REGISTRY }}

jobs:
build-push:
Expand All @@ -31,21 +31,17 @@ jobs:
- uses: actions/checkout@v4

- name: Build Image
run: ./build.ps1 -Name ${{ env.IMAGE_NAME }} -Registry ${{ env.REGISTRY }}
run: ./build.ps1 -Name '${{ env.IMAGE_NAME }}' -Registry '${{ env.REGISTRY }}' -Tag '${{ env.TAG }}'
shell: pwsh
env:
TAG: ${{ github.event_name == 'pull_request' && format('-t {0}/{1}:pr-{2}', env.REGISTRY, env.IMAGE_NAME, github.event.number) }}

- name: Login to private container registry
if: ${{ github.event_name == 'pull_request' }}
- name: Login to container registry
uses: docker/login-action@v3
with:
registry: "${{ vars.DOCKER_REGISTRY }}"
username: "${{ secrets.DOCKER_USERNAME }}"
password: "${{ secrets.DOCKER_PASSWORD }}"
- name: Login to Docker Hub
if: ${{ github.event_name != 'pull_request' }}
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
registry: ${{ vars.DOCKER_REGISTRY }}
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Push image
run: docker push --all-tags ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
10 changes: 5 additions & 5 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
:!toc-title:
:linkattrs:

GitHub repo for SteeltoeOSS Docker images.
GitHub repo for server images to use for local development with SteeltoeOSS.

== Building

Expand All @@ -28,16 +28,16 @@ See the link:https://github.com/SteeltoeOSS/Samples/blob/main/CommonTasks.md/[do
|===
|Name |Description

|link:config-server/[steeltoeoss/config-server]
|link:config-server/[steeltoe.azurecr.io/config-server]
| Spring Cloud Config Server

|link:eureka-server/[steeltoeoss/eureka-server]
|link:eureka-server/[steeltoe.azurecr.io/eureka-server]
| Netflix Eureka Server

|link:spring-boot-admin/[steeltoeoss/spring-boot-admin]
|link:spring-boot-admin/[steeltoe.azurecr.io/spring-boot-admin]
| Spring Boot Admin

|link:uaa-server/[steeltoeoss/uaa-server]
|link:uaa-server/[steeltoe.azurecr.io/uaa-server]
| CloudFoundry UAA Server

|===
Expand Down
26 changes: 7 additions & 19 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,6 @@ if (!(Test-Path $ImageDirectory))
throw "Unknown image $Name; run with -List to list available images"
}

$Name = Split-Path -Leaf $ImageDirectory # this removes stuff like ".\" prefix

if (!(Get-Command "docker" -ErrorAction SilentlyContinue))
{
throw "'docker' command not found"
Expand All @@ -116,28 +114,18 @@ if (!$Tag)
{
$Tag += "-$Revision"
}
$Tag += " $(Get-Content $ImageDirectory/metadata/ADDITIONAL_TAGS | ForEach { $_.replace("$Name","$DockerOrg/$Name") })"
$Tag += " $(Get-Content $ImageDirectory/metadata/ADDITIONAL_TAGS | ForEach-Object { $_.replace("$Name","$DockerOrg/$Name") })"
}
else
{
$DockerArch = "amd64"
$DockerOs = "linux"
$Tag = "-t $DockerOrg/$Name-$DockerArch-$DockerOS"
$VersionMatcher = Select-String -Path $Dockerfile -Pattern '^ENV\s+IMAGE_VERSION\s*=?\s*(.+)$'
if ($VersionMatcher)
{
$Version = $VersionMatcher.Matches.Groups[1]
$Tag += ":$Version"
$RevisionMatcher = Select-String -Path $Dockerfile -Pattern '^ENV\s+IMAGE_REVISION\s*=?\s*(.+)$'
if ($RevisionMatcher)
{
$Revision = $RevisionMatcher.Matches.Groups[1]
$Tag += "-$Revision"
}
}
throw "No metadata found for $Name"
}
}
else
{
Write-Host "Tag value set by script parameter:" $Tag
}

$docker_command = "docker build $Tag $ImageDirectory"
Write-host $docker_command
Write-Host $docker_command
Invoke-Expression $docker_command
24 changes: 12 additions & 12 deletions config-server/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
# Spring Config Server Build
# -----------------------------------------------------------------------------

FROM eclipse-temurin:21-alpine as build
FROM eclipse-temurin:21-alpine AS build
WORKDIR /scratch
RUN apk add httpie && apk add patch
RUN http https://start.spring.io/starter.zip \
type==gradle-project \
platformVersion==3.2.4 \
jvmVersion==21 \
groupId==io.steeltoe.docker \
artifactId==configserver \
applicationName==ConfigServer \
language==java \
dependencies==cloud-config-server,actuator,cloud-eureka \
RUN apk update && apk add ca-certificates && apk add curl && apk add patch
RUN curl --get https://start.spring.io/starter.zip \
-d "type=gradle-project" \
-d "platformVersion=3.3.4" \
-d "jvmVersion=21" \
-d "groupId=io.steeltoe.docker" \
-d "artifactId=configserver" \
-d "applicationName=ConfigServer" \
-d "language=java" \
-d "dependencies=cloud-config-server,actuator,cloud-eureka" \
--output configserver.zip
RUN mkdir configserver && unzip -d configserver configserver.zip
COPY metadata metadata
Expand All @@ -34,7 +34,7 @@ RUN mkdir output && \
# Spring Config Server Linux Image
# -----------------------------------------------------------------------------

FROM eclipse-temurin:21
FROM eclipse-temurin:21-alpine
WORKDIR /config-server
COPY --from=build /scratch/output .
EXPOSE 8888
Expand Down
10 changes: 5 additions & 5 deletions config-server/README.adoc
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
= steeltoeoss/config-server
= steeltoe.azurecr.io/config-server
:toc: preamble
:toclevels: 1
:!toc-title:
:linkattrs:

SteeltoeOSS https://cloud.spring.io/spring-cloud-config/[Spring Cloud Config Server] docker image.
Image for SteeltoeOSS local development with https://cloud.spring.io/spring-cloud-config/[Spring Cloud Config Server].

== Running

.Default Configuration
----
$ docker run --publish 8888:8888 steeltoeoss/config-server
$ docker run --publish 8888:8888 steeltoe.azurecr.io/config-server
----

.Custom Git Repo Configuration
----
$ docker run --publish 8888:8888 steeltoeoss/config-server \
$ docker run --publish 8888:8888 steeltoe.azurecr.io/config-server \
--spring.cloud.config.server.git.uri=https://github.com/myorg/myrepo.git
----

.Local File System Configuration
----
$ docker run --publish 8888:8888 --volume /path/to/my/config:/config steeltoeoss/config-server \
$ docker run --publish 8888:8888 --volume /path/to/my/config:/config steeltoe.azurecr.io/config-server \
--spring.profiles.active=native \
--spring.cloud.config.server.native.searchLocations=file:///config
----
Expand Down
2 changes: 1 addition & 1 deletion config-server/metadata/IMAGE_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.1.1
4.1.3
8 changes: 6 additions & 2 deletions config-server/patches/version.patch
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
--- configserver/build.gradle 2024-02-21 09:39:40.000000000 -0600
+++ configserver/build.gradle 2024-02-21 11:03:17.615054116 -0600
@@ -5,7 +5,7 @@
@@ -5,11 +5,11 @@
}

group = 'io.steeltoe.docker'
-version = '0.0.1-SNAPSHOT'
+version = '<VERSION>'

java {
sourceCompatibility = '17'
toolchain {
- languageVersion = JavaLanguageVersion.of(17)
+ languageVersion = JavaLanguageVersion.of(21)
}
}
22 changes: 11 additions & 11 deletions eureka-server/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
# Netflix Eureka Server Build
# -----------------------------------------------------------------------------

FROM eclipse-temurin:21-alpine as build
FROM eclipse-temurin:21-alpine AS build
WORKDIR /scratch
RUN apk add httpie && apk add patch
RUN http https://start.spring.io/starter.zip \
type==gradle-project \
platformVersion==3.2.4 \
jvmVersion==21 \
groupId==io.steeltoe.docker \
artifactId==eurekaserver \
applicationName==EurekaServer \
language==java \
dependencies==cloud-eureka-server,actuator \
RUN apk update && apk add ca-certificates && apk add curl && apk add patch
RUN curl --get https://start.spring.io/starter.zip \
-d "type=gradle-project" \
-d "platformVersion=3.3.4" \
-d "jvmVersion=21" \
-d "groupId=io.steeltoe.docker" \
-d "artifactId=eurekaserver" \
-d "applicationName=EurekaServer" \
-d "language=java" \
-d "dependencies=cloud-eureka-server,actuator" \
--output eurekaserver.zip
RUN mkdir eurekaserver && unzip -d eurekaserver eurekaserver.zip
COPY metadata metadata
Expand Down
6 changes: 3 additions & 3 deletions eureka-server/README.adoc
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
= steeltoeoss/eureka-server
= steeltoe.azurecr.io/eureka-server
:toc: preamble
:toclevels: 1
:!toc-title:
:linkattrs:

SteeltoeOSS https://cloud.spring.io/spring-cloud-netflix/[Spring Cloud Eureka Server] docker image.
Image for SteeltoeOSS local development with https://cloud.spring.io/spring-cloud-netflix/[Spring Cloud Eureka Server].

== Running

----
$ docker run --publish 8761:8761 steeltoeoss/eureka-server
$ docker run --publish 8761:8761 steeltoe.azurecr.io/eureka-server
----

== Resources
Expand Down
2 changes: 1 addition & 1 deletion eureka-server/metadata/IMAGE_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.1.1
4.1.3
Loading