Skip to content

Commit c337676

Browse files
committed
added auth step in docker file at build stage
1 parent a395b3b commit c337676

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

.github/workflows/release-to-github-packages.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
- uses: actions/checkout@v4
2323
with:
2424
fetch-depth: 0
25-
25+
2626
- name: Determine environment and config
2727
id: config
2828
run: |
@@ -64,7 +64,7 @@ jobs:
6464
CONTAINER="abdu7511-catalog"
6565
PROFILE="test"
6666
fi
67-
67+
6868
echo "ENVIRONMENT=${ENV}" >> $GITHUB_OUTPUT
6969
echo "SHOULD_RELEASE=${SHOULD_RELEASE}" >> $GITHUB_OUTPUT
7070
echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT
@@ -73,7 +73,7 @@ jobs:
7373
echo "TASK_DEF=${TASK_DEF}" >> $GITHUB_OUTPUT
7474
echo "CONTAINER=${CONTAINER}" >> $GITHUB_OUTPUT
7575
echo "PROFILE=${PROFILE}" >> $GITHUB_OUTPUT
76-
76+
7777
echo "Deploying to: ${ENV}"
7878
echo "Should release JAR: ${SHOULD_RELEASE}"
7979
echo "Version: ${VERSION}"
@@ -85,10 +85,10 @@ jobs:
8585
if: needs.determine-config.outputs.should_release == 'true'
8686
steps:
8787
- uses: actions/checkout@v4
88-
88+
8989
- name: Set version
9090
run: mvn versions:set -DnewVersion=${{ needs.determine-config.outputs.version }} -DgenerateBackupPoms=false
91-
91+
9292
- name: Build and test
9393
run: mvn clean test -B
9494

docker/Dockerfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,17 @@ RUN mkdir -p /home/cl && \
1616
# ======================== Build cloudfeeds catalog using maven =======================
1717
FROM maven:3.8.6-openjdk-8-slim AS builder
1818

19+
ARG GITHUB_ACTOR
20+
ARG GITHUB_TOKEN
21+
1922
LABEL Maintainer="cloudfeeds-core@rackspace.com" \
2023
description="Docker image for Cloudfeeds Catalog" \
2124
NAME="cloudfeeds-catalog"
2225

26+
# Create Maven settings for GitHub Packages
27+
RUN mkdir -p /root/.m2 && \
28+
echo '<settings><servers><server><id>github</id><username>'"${GITHUB_ACTOR}"'</username><password>'"${GITHUB_TOKEN}"'</password></server></servers></settings>' > /root/.m2/settings.xml
29+
2330
WORKDIR /cf-catalog
2431
COPY --from=fetcher /home/cl/pom.xml /cf-catalog/pom.xml
2532

0 commit comments

Comments
 (0)