Skip to content

Commit

Permalink
Switch to jib extension for container image (#59)
Browse files Browse the repository at this point in the history
  • Loading branch information
derkoe authored Mar 29, 2022
1 parent 1fb90e7 commit 739d881
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 70 deletions.
30 changes: 23 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,24 @@ on:

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup java
uses: actions/setup-java@v3
with:
java-version: 11
distribution: adopt
- name: Build
run: mvn -B package
- name: Docker Login
if: ${{ github.event_name != 'pull_request'}}
run: echo ${{ secrets.GHCR_PASSWORD }} | docker login ghcr.io -u ${{ secrets.GHCR_USERNAME }} --password-stdin
- name: Push image
if: ${{ github.event_name != 'pull_request'}}
run: mvn package -Dquarkus.container-image.push

build-native:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -17,12 +35,10 @@ jobs:
java-version: 11
distribution: adopt
- name: Build Native
run: mvn -B package -Pnative
- name: Build Native Image
run: mvn -B package -Pnative -Dquarkus.container-image.build -Dquarkus.container-image.tag=main-native
- name: Docker Login
if: ${{ github.event_name != 'pull_request'}}
run: docker build -f src/main/docker/Dockerfile.native -t ghcr.io/derkoe/quarkus-htmx-todos:${GITHUB_REF:11} .
- name: Push image to ghcr.io
run: echo ${{ secrets.GHCR_PASSWORD }} | docker login ghcr.io -u ${{ secrets.GHCR_USERNAME }} --password-stdin
- name: Push Native Image
if: ${{ github.event_name != 'pull_request'}}
run: |
echo ${{ secrets.GHCR_PASSWORD }} | docker login ghcr.io -u ${{ secrets.GHCR_USERNAME }} --password-stdin
docker push ghcr.io/derkoe/quarkus-htmx-todos:${GITHUB_REF:11}
run: mvn -B package -Pnative -Dquarkus.container-image.push -Dquarkus.native.reuse-existing=true -Dquarkus.container-image.tag=main-native
6 changes: 3 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
version: "3"
services:
app:
build:
context: .
dockerfile: src/main/docker/Dockerfile
image: ghcr.io/derkoe/quarkus-htmx-todos:main
environment:
QUARKUS_DATASOURCE_JDBC_URL: jdbc:postgresql://database:5432/todos
ports:
- "8080:8080"
links:
- database
depends_on:
- database
database:
image: postgres:14-alpine
environment:
Expand Down
9 changes: 8 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<version>1.0.0-SNAPSHOT</version>
<properties>
<compiler-plugin.version>3.10.1</compiler-plugin.version>
<htmx.version>1.7.0</htmx.version>
<maven.compiler.parameters>true</maven.compiler.parameters>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
Expand All @@ -15,7 +16,9 @@
<quarkus-plugin.version>2.7.5.Final</quarkus-plugin.version>
<quarkus.platform.version>2.7.5.Final</quarkus.platform.version>
<surefire-plugin.version>2.22.2</surefire-plugin.version>
<htmx.version>1.7.0</htmx.version>
<quarkus.container-image.registry>ghcr.io</quarkus.container-image.registry>
<quarkus.container-image.group>derkoe</quarkus.container-image.group>
<quarkus.container-image.name>quarkus-htmx-todos</quarkus.container-image.name>
</properties>
<dependencyManagement>
<dependencies>
Expand Down Expand Up @@ -74,6 +77,10 @@
<artifactId>htmx.org</artifactId>
<version>${htmx.version}</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-container-image-jib</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-junit5</artifactId>
Expand Down
32 changes: 0 additions & 32 deletions src/main/docker/Dockerfile

This file was deleted.

27 changes: 0 additions & 27 deletions src/main/docker/Dockerfile.native

This file was deleted.

0 comments on commit 739d881

Please sign in to comment.