Skip to content

Commit

Permalink
Add source code label to Dockerfile to link to ghcr
Browse files Browse the repository at this point in the history
  • Loading branch information
zachauten committed Sep 24, 2024
1 parent bb42fec commit 45a9eec
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
13 changes: 11 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,28 @@ on: push
jobs:
Build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
attestations: write
id-token: write

steps:
- uses: actions/checkout@v4

- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- uses: docker/metadata-action@v5
with:
images: |
${{ github.repository_owner }}/${{ github.repository }}
ghcr.io/${{ github.repository }}
- uses: docker/bake-action@v5

with:
files: |
./docker-bake.hcl
Expand Down
7 changes: 2 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
# docker build -t spring-app .
# docker run --name spring-app -d -p 8080:8080 spring-app

# docker run --name spring-boilerplate -d -p 8080:8080 spring-boilerplate
FROM maven:3.9.8-eclipse-temurin-21 as build

COPY pom.xml .
RUN --mount=type=cache,target=/root/.m2,rw mvn -B dependency:go-offline
COPY src src
RUN --mount=type=cache,target=/root/.m2,rw mvn -B package

FROM eclipse-temurin:21
FROM eclipse-temurin:21-jammy

WORKDIR /app
COPY --from=build target/*.jar ./app.jar
Expand All @@ -25,4 +23,3 @@ ENTRYPOINT ["java", "-javaagent:/app/opentelemetry-javaagent.jar", "-jar", "app.

EXPOSE 8080
HEALTHCHECK CMD curl -f http://0.0.0.0:8080/health || exit 1

1 change: 0 additions & 1 deletion docker-bake.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@ target "default" {
inherits = ["docker-metadata-action"]
context = "."
dockerfile = "Dockerfile"
tags = ["spring-boilerplate:latest"]
}

0 comments on commit 45a9eec

Please sign in to comment.