Skip to content

Commit 2e13f69

Browse files
committed
Update Docker build configuration for GitHub Packages
- Add build arguments for GITHUB_ACTOR and GITHUB_TOKEN - Configure Maven to use GitHub Packages with provided token
1 parent b4e1371 commit 2e13f69

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

.github/workflows/docker-publish.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,7 @@ jobs:
3333
with:
3434
context: .
3535
push: true
36-
tags: ${{ steps.meta.outputs.tags }}
36+
tags: ${{ steps.meta.outputs.tags }}
37+
build-args: |
38+
GITHUB_ACTOR=${{ github.actor }}
39+
GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}

Dockerfile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,16 @@ RUN npm run build
1212
# ─── Stage 2: Build backend ────────────────────────────────────────────────
1313
FROM maven:3.9-eclipse-temurin-17-alpine AS backend-builder
1414

15+
ARG GITHUB_ACTOR
16+
ARG GITHUB_TOKEN
17+
1518
WORKDIR /app
1619

20+
# Configure Maven to use GitHub Packages if GITHUB_TOKEN is provided
21+
RUN if [ -n "${GITHUB_TOKEN}" ]; then \
22+
mkdir -p /root/.m2 && printf '<settings>\n <servers>\n <server>\n <id>github</id>\n <username>%s</username>\n <password>%s</password>\n </server>\n </servers>\n</settings>\n' "${GITHUB_ACTOR}" "${GITHUB_TOKEN}" > /root/.m2/settings.xml; \
23+
fi
24+
1725
COPY pom.xml ./
1826
RUN mvn dependency:go-offline -q
1927

0 commit comments

Comments
 (0)