Skip to content

Commit

Permalink
from buildpacks to google jib
Browse files Browse the repository at this point in the history
  • Loading branch information
MichiBaum committed Feb 19, 2024
1 parent b39b83e commit 6148f26
Show file tree
Hide file tree
Showing 10 changed files with 152 additions and 204 deletions.
7 changes: 2 additions & 5 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,5 @@ jobs:
run: mvn javadoc:aggregate

- name: Maven Clean install
# Windows: ./mvnw clean install "-DdockerHub.username=${{secrets.DOCKER_USERNAME}}" "-DdockerHub.password=${{secrets.DOCKER_PASSWORD}}"
run: mvn clean install -DdockerHub.username=${{secrets.DOCKER_USERNAME}} -DdockerHub.password=${{secrets.DOCKER_PASSWORD}} -DdockerHub.publish=true

# - name: Build & Publish docker images
# run: mvn spring-boot:build-image --projects ./gateway-service,./admin-service,./javadoc-service,./registry-service,./usermanagement-service,./authentication-service -DdockerHub.username=${{secrets.DOCKER_USERNAME}} -DdockerHub.password=${{secrets.DOCKER_PASSWORD}}
# Windows: ./mvnw compile jib:build "-DdockerHub.username=${{secrets.DOCKER_USERNAME}}" "-DdockerHub.password=${{secrets.DOCKER_PASSWORD}}"
run: mvn compile jib:build -DdockerHub.username=${{secrets.DOCKER_USERNAME}} -DdockerHub.password=${{secrets.DOCKER_PASSWORD}}
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ In *C:\Windows\System32\drivers\etc* find file *hosts* and add those lines:
127.0.0.1 javadoc.michibaum.ch
127.0.0.1 usermanagement.michibaum.ch
127.0.0.1 authentication.michibaum.ch
127.0.0.1 zipkin.michibaum.ch

#### Linux

Expand Down
48 changes: 17 additions & 31 deletions admin-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,44 +66,30 @@
</resources>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<groupId>com.google.cloud.tools</groupId>
<artifactId>jib-maven-plugin</artifactId>
<version>3.4.0</version>
<configuration>
<layers>
<enabled>true</enabled>
</layers>
<additionalProperties>
<time>${maven.build.timestamp}</time>
</additionalProperties>
<excludeDevtools>true</excludeDevtools>
<optimizedLaunch>true</optimizedLaunch>
<image>
<!--suppress UnresolvedMavenProperty -->
<name>registry.hub.docker.com/${dockerHub.username}/${project.artifactId}:${project.version}</name>
<from>
<image>eclipse-temurin:21-jre</image>
<auth>
<!--suppress UnresolvedMavenProperty -->
<username>${dockerHub.username}</username>
<!--suppress UnresolvedMavenProperty -->
<password>${dockerHub.password}</password>
</auth>
</from>
<to>
<!--suppress UnresolvedMavenProperty -->
<publish>${dockerHub.publish}</publish>
<env>
<BP_JVM_VERSION>21</BP_JVM_VERSION>
</env>
</image>
<docker>
<publishRegistry>
<image>docker.io/${dockerHub.username}/${project.artifactId}</image>
<auth>
<!--suppress UnresolvedMavenProperty -->
<username>${dockerHub.username}</username>
<!--suppress UnresolvedMavenProperty -->
<password>${dockerHub.password}</password>
<url>${dockerHub.url}</url>
</publishRegistry>
</docker>
</auth>
</to>
</configuration>
<executions>
<execution>
<goals>
<goal>build-info</goal>
<goal>build-image</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>io.github.git-commit-id</groupId>
Expand Down
48 changes: 17 additions & 31 deletions authentication-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -93,44 +93,30 @@
</resources>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<groupId>com.google.cloud.tools</groupId>
<artifactId>jib-maven-plugin</artifactId>
<version>3.4.0</version>
<configuration>
<layers>
<enabled>true</enabled>
</layers>
<additionalProperties>
<time>${maven.build.timestamp}</time>
</additionalProperties>
<excludeDevtools>true</excludeDevtools>
<optimizedLaunch>false</optimizedLaunch>
<image>
<!--suppress UnresolvedMavenProperty -->
<name>registry.hub.docker.com/${dockerHub.username}/${project.artifactId}:${project.version}</name>
<from>
<image>eclipse-temurin:21-jre</image>
<auth>
<!--suppress UnresolvedMavenProperty -->
<username>${dockerHub.username}</username>
<!--suppress UnresolvedMavenProperty -->
<password>${dockerHub.password}</password>
</auth>
</from>
<to>
<!--suppress UnresolvedMavenProperty -->
<publish>${dockerHub.publish}</publish>
<env>
<BP_JVM_VERSION>21</BP_JVM_VERSION>
</env>
</image>
<docker>
<publishRegistry>
<image>docker.io/${dockerHub.username}/${project.artifactId}</image>
<auth>
<!--suppress UnresolvedMavenProperty -->
<username>${dockerHub.username}</username>
<!--suppress UnresolvedMavenProperty -->
<password>${dockerHub.password}</password>
<url>${dockerHub.url}</url>
</publishRegistry>
</docker>
</auth>
</to>
</configuration>
<executions>
<execution>
<goals>
<goal>build-info</goal>
<goal>build-image</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>io.github.git-commit-id</groupId>
Expand Down
55 changes: 48 additions & 7 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,20 @@ services:
- .env
- .env.override
restart: always
depends_on:
- zipkin
environment:
spring_profiles_active: ${SPRING_ACTIVE_PROFILES}
expose:
- "8761"
networks:
- microservice-network
deploy:
resources:
limits:
cpus: '0.50'
memory: 500M
reservations:
cpus: '0.20'
memory: 250M

admin-service:
image: 70131370/admin-service:1.0.0-TEST-8
Expand All @@ -25,13 +31,20 @@ services:
restart: always
depends_on:
- registry-service
- zipkin
environment:
spring_profiles_active: ${SPRING_ACTIVE_PROFILES}
expose:
- "80"
networks:
- microservice-network
deploy:
resources:
limits:
cpus: '0.50'
memory: 500M
reservations:
cpus: '0.20'
memory: 250M

javadoc-service:
image: 70131370/javadoc-service:1.0.0-TEST-8
Expand All @@ -41,13 +54,20 @@ services:
restart: always
depends_on:
- registry-service
- zipkin
environment:
spring_profiles_active: ${SPRING_ACTIVE_PROFILES}
expose:
- "80"
networks:
- microservice-network
deploy:
resources:
limits:
cpus: '0.50'
memory: 500M
reservations:
cpus: '0.20'
memory: 250M

authentication-service:
image: 70131370/authentication-service:1.0.0-TEST-8
Expand All @@ -57,7 +77,6 @@ services:
restart: always
depends_on:
- registry-service
- zipkin
environment:
spring_profiles_active: ${SPRING_ACTIVE_PROFILES}
DATABASE_PASSWORD: ${AUTHENTICATION_DB_PASSWORD}
Expand All @@ -66,6 +85,14 @@ services:
- "80"
networks:
- microservice-network
deploy:
resources:
limits:
cpus: '0.50'
memory: 500M
reservations:
cpus: '0.20'
memory: 250M

authentication-db:
image: mysql:8.0
Expand All @@ -92,7 +119,6 @@ services:
depends_on:
- registry-service
- usermanagement-db
- zipkin
environment:
spring_profiles_active: ${SPRING_ACTIVE_PROFILES}
DATABASE_PASSWORD: ${USERMANAGEMENT_DB_PASSWORD}
Expand All @@ -101,6 +127,14 @@ services:
- "80"
networks:
- microservice-network
deploy:
resources:
limits:
cpus: '0.50'
memory: 500M
reservations:
cpus: '0.20'
memory: 250M

usermanagement-db:
image: mysql:8.0
Expand All @@ -126,13 +160,20 @@ services:
restart: always
depends_on:
- registry-service
- zipkin
environment:
spring_profiles_active: ${SPRING_ACTIVE_PROFILES}
ports:
- "80:80"
networks:
- microservice-network
deploy:
resources:
limits:
cpus: '0.50'
memory: 500M
reservations:
cpus: '0.20'
memory: 250M

# Matomo
# https://medium.com/@davquar/matomo-lets-install-it-with-docker-512211705c76
Expand Down
48 changes: 17 additions & 31 deletions gateway-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -70,44 +70,30 @@
</resources>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<groupId>com.google.cloud.tools</groupId>
<artifactId>jib-maven-plugin</artifactId>
<version>3.4.0</version>
<configuration>
<layers>
<enabled>true</enabled>
</layers>
<additionalProperties>
<time>${maven.build.timestamp}</time>
</additionalProperties>
<excludeDevtools>true</excludeDevtools>
<optimizedLaunch>false</optimizedLaunch>
<image>
<!--suppress UnresolvedMavenProperty -->
<name>registry.hub.docker.com/${dockerHub.username}/${project.artifactId}:${project.version}</name>
<from>
<image>eclipse-temurin:21-jre</image>
<auth>
<!--suppress UnresolvedMavenProperty -->
<username>${dockerHub.username}</username>
<!--suppress UnresolvedMavenProperty -->
<password>${dockerHub.password}</password>
</auth>
</from>
<to>
<!--suppress UnresolvedMavenProperty -->
<publish>${dockerHub.publish}</publish>
<env>
<BP_JVM_VERSION>21</BP_JVM_VERSION>
</env>
</image>
<docker>
<publishRegistry>
<image>docker.io/${dockerHub.username}/${project.artifactId}</image>
<auth>
<!--suppress UnresolvedMavenProperty -->
<username>${dockerHub.username}</username>
<!--suppress UnresolvedMavenProperty -->
<password>${dockerHub.password}</password>
<url>${dockerHub.url}</url>
</publishRegistry>
</docker>
</auth>
</to>
</configuration>
<executions>
<execution>
<goals>
<goal>build-info</goal>
<goal>build-image</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>io.github.git-commit-id</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,6 @@ class RoutesConfiguration {
// filters { AuthorizationPreFilter() }
uri("lb://usermanagement-service")
}
route {
host("zipkin.michibaum.ch")
// filters { AuthorizationPreFilter() }
uri("lb://zipkin-service")
}
route {
host("google.michibaum.ch")
// filters { AuthorizationPreFilter() }
Expand Down
Loading

0 comments on commit 6148f26

Please sign in to comment.