Skip to content

Commit 8f25b59

Browse files
authored
Merge pull request #368 from OpenMS/ci/fix-dockerfile-token-cache-bust
fix(docker): scope GITHUB_TOKEN to one RUN so registry cache can hit
2 parents bd9bf5e + 859e481 commit 8f25b59

2 files changed

Lines changed: 12 additions & 14 deletions

File tree

Dockerfile

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@ FROM ubuntu:22.04 AS setup-build-system
1111
ARG OPENMS_REPO=https://github.com/OpenMS/OpenMS.git
1212
ARG OPENMS_BRANCH=release/3.5.0
1313
ARG PORT=8501
14-
# GitHub token to download latest OpenMS executable for Windows from Github action artifact.
15-
ARG GITHUB_TOKEN
16-
ENV GH_TOKEN=${GITHUB_TOKEN}
1714
# Streamlit app Gihub user name (to download artifact from).
1815
ARG GITHUB_USER=OpenMS
1916
# Streamlit app Gihub repository name (to download artifact from).
@@ -227,12 +224,14 @@ RUN mamba run -n streamlit-env python hooks/hook-analytics.py
227224
# Set Online Deployment
228225
RUN jq '.online_deployment = true' settings.json > tmp.json && mv tmp.json settings.json
229226

230-
# Download latest OpenMS App executable as a ZIP file
231-
RUN if [ -n "$GH_TOKEN" ]; then \
232-
echo "GH_TOKEN is set, proceeding to download the release asset..."; \
227+
# Download latest OpenMS App executable as a ZIP file.
228+
# ARG declared here (not at the top) — otherwise the per-run token busts the cache.
229+
ARG GITHUB_TOKEN
230+
RUN if [ -n "$GITHUB_TOKEN" ]; then \
231+
echo "GITHUB_TOKEN is set, proceeding to download the release asset..."; \
233232
gh release download -R ${GITHUB_USER}/${GITHUB_REPO} -p "OpenMS-App.zip" -D /app; \
234233
else \
235-
echo "GH_TOKEN is not set, skipping the release asset download."; \
234+
echo "GITHUB_TOKEN is not set, skipping the release asset download."; \
236235
fi
237236

238237

Dockerfile_simple

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@ FROM ubuntu:22.04 AS stage1
1111
ARG OPENMS_REPO=https://github.com/OpenMS/OpenMS.git
1212
ARG OPENMS_BRANCH=develop
1313
ARG PORT=8501
14-
# GitHub token to download latest OpenMS executable for Windows from Github action artifact.
15-
ARG GITHUB_TOKEN
16-
ENV GH_TOKEN=${GITHUB_TOKEN}
1714
# Streamlit app Gihub user name (to download artifact from).
1815
ARG GITHUB_USER=OpenMS
1916
# Streamlit app Gihub repository name (to download artifact from).
@@ -139,12 +136,14 @@ RUN mamba run -n streamlit-env python hooks/hook-analytics.py
139136
# Set Online Deployment
140137
RUN jq '.online_deployment = true' settings.json > tmp.json && mv tmp.json settings.json
141138

142-
# Download latest OpenMS App executable as a ZIP file
143-
RUN if [ -n "$GH_TOKEN" ]; then \
144-
echo "GH_TOKEN is set, proceeding to download the release asset..."; \
139+
# Download latest OpenMS App executable as a ZIP file.
140+
# ARG declared here (not at the top) — otherwise the per-run token busts the cache.
141+
ARG GITHUB_TOKEN
142+
RUN if [ -n "$GITHUB_TOKEN" ]; then \
143+
echo "GITHUB_TOKEN is set, proceeding to download the release asset..."; \
145144
gh release download -R ${GITHUB_USER}/${GITHUB_REPO} -p "OpenMS-App.zip" -D /app; \
146145
else \
147-
echo "GH_TOKEN is not set, skipping the release asset download."; \
146+
echo "GITHUB_TOKEN is not set, skipping the release asset download."; \
148147
fi
149148

150149
# make sure that mamba environment is used

0 commit comments

Comments
 (0)