Skip to content

Commit 902cf46

Browse files
authored
Merge pull request #65 from OpenMS/develop_macos_arm_docker
Develop macos arm docker
2 parents c228da3 + 15b03a4 commit 902cf46

4 files changed

Lines changed: 45 additions & 19 deletions

File tree

.github/workflows/build-docker-images.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,12 @@ jobs:
1515
contents: read
1616

1717
steps:
18-
- uses: actions/checkout@v3
18+
- name: Free disk space
19+
run: |
20+
sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache
21+
sudo apt-get clean
22+
df -h
23+
- uses: actions/checkout@v4
1924
- name: Build the full Docker image
2025
run: docker build --file Dockerfile --tag streamlitapp:latest --build-arg GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} --output type=tar,dest=/dev/null .
2126

@@ -26,6 +31,11 @@ jobs:
2631
contents: read
2732

2833
steps:
29-
- uses: actions/checkout@v3
34+
- name: Free disk space
35+
run: |
36+
sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache
37+
sudo apt-get clean
38+
df -h
39+
- uses: actions/checkout@v4
3040
- name: Build the ARM64 Docker image
3141
run: docker build --file Dockerfile.arm --tag streamlitapp:latest-arm64 --build-arg GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} --output type=tar,dest=/dev/null .

.github/workflows/publish-docker-images.yml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88
inputs:
99
tag:
1010
description: 'Release tag to build (e.g., v0.9.15)'
11-
required: true
11+
required: false
1212

1313
jobs:
1414

@@ -31,15 +31,23 @@ jobs:
3131
run: |
3232
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
3333
TAG="${{ github.event.inputs.tag }}"
34-
SHA=$(gh api repos/${{ github.repository }}/git/ref/tags/${TAG} --jq '.object.sha')
34+
if [ -n "$TAG" ]; then
35+
SHA=$(gh api repos/${{ github.repository }}/git/ref/tags/${TAG} --jq '.object.sha')
36+
VERSION="${TAG#v}"
37+
else
38+
# No tag — build from branch HEAD
39+
SHA="${{ github.sha }}"
40+
VERSION="${{ github.ref_name }}"
41+
fi
3542
else
3643
# workflow_run: get the tag from the head branch (release events set head_branch to the tag)
3744
TAG="${{ github.event.workflow_run.head_branch }}"
3845
SHA="${{ github.event.workflow_run.head_sha }}"
46+
VERSION="${TAG#v}"
3947
fi
4048
41-
# Strip leading 'v' for version
42-
VERSION="${TAG#v}"
49+
# Sanitize VERSION for valid Docker tags: replace / with -, strip invalid chars
50+
VERSION=$(echo "$VERSION" | tr '/' '-' | tr -cd 'A-Za-z0-9_.-')
4351
4452
echo "Resolved tag=${TAG} version=${VERSION} sha=${SHA}"
4553
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
@@ -82,6 +90,7 @@ jobs:
8290
file: Dockerfile
8391
push: true
8492
tags: ${{ env.IMAGE }}:${{ needs.resolve-tag.outputs.version }}-amd64
93+
provenance: false
8594
build-args: |
8695
GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
8796
cache-from: type=registry,ref=${{ env.IMAGE }}:buildcache-amd64
@@ -124,6 +133,7 @@ jobs:
124133
file: Dockerfile.arm
125134
push: true
126135
tags: ${{ env.IMAGE }}:${{ needs.resolve-tag.outputs.version }}-arm64
136+
provenance: false
127137
build-args: |
128138
GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
129139
cache-from: type=registry,ref=${{ env.IMAGE }}:buildcache-arm64

Dockerfile

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ ARG OPENMS_BRANCH=FVdeploy
3232
ARG PORT=8501
3333
# GitHub token to download latest OpenMS executable for Windows from Github action artifact.
3434
ARG GITHUB_TOKEN
35-
ENV GH_TOKEN=${GITHUB_TOKEN}
3635
# Streamlit app Gihub user name (to download artifact from).
3736
ARG GITHUB_USER=OpenMS
3837
# Streamlit app Gihub repository name (to download artifact from).
@@ -90,7 +89,7 @@ RUN mkdir /thirdparty && \
9089
cp -r THIRDPARTY/All/* /thirdparty && \
9190
cp -r THIRDPARTY/Linux/x86_64/* /thirdparty && \
9291
chmod -R +x /thirdparty
93-
ENV PATH="/thirdparty/LuciPHOr2:/thirdparty/MSGFPlus:/thirdparty/Sirius:/thirdparty/ThermoRawFileParser:/thirdparty/Comet:/thirdparty/Fido:/thirdparty/MaRaCluster:/thirdparty/MyriMatch:/thirdparty/OMSSA:/thirdparty/Percolator:/thirdparty/SpectraST:/thirdparty/XTandem:/thirdparty/crux:${PATH}"
92+
ENV PATH="/thirdparty/LuciPHOr2:/thirdparty/MSGFPlus:/thirdparty/ThermoRawFileParser:/thirdparty/Comet:/thirdparty/Percolator:/thirdparty/Sage:${PATH}"
9493

9594
# Build OpenMS and pyOpenMS.
9695
FROM setup-build-system AS compile-openms
@@ -190,7 +189,7 @@ service cron start\n\
190189
\n\
191190
# Start Redis server in background\n\
192191
echo "Starting Redis server..."\n\
193-
redis-server --daemonize yes --dir /var/lib/redis --appendonly no\n\
192+
redis-server --daemonize yes --dir /var/lib/redis --appendonly no --ignore-warnings ARM64-COW-BUG\n\
194193
\n\
195194
# Wait for Redis to be ready\n\
196195
until redis-cli ping > /dev/null 2>&1; do\n\
@@ -250,11 +249,15 @@ RUN mamba run -n streamlit-env python hooks/hook-analytics.py
250249
RUN jq '.online_deployment = true' settings.json > tmp.json && mv tmp.json settings.json
251250

252251
# Download latest OpenMS App executable as a ZIP file
253-
RUN if [ -n "$GH_TOKEN" ]; then \
254-
echo "GH_TOKEN is set, proceeding to download the release asset..."; \
255-
gh release download -R ${GITHUB_USER}/${GITHUB_REPO} -p "OpenMS-App.zip" -D /app; \
252+
# Re-declare ARGs needed in this stage (ARGs don't persist across FROM)
253+
ARG GITHUB_TOKEN
254+
ARG GITHUB_USER=OpenMS
255+
ARG GITHUB_REPO=FLASHApp
256+
RUN if [ -n "$GITHUB_TOKEN" ]; then \
257+
echo "Downloading release asset..."; \
258+
GH_TOKEN="$GITHUB_TOKEN" gh release download -R ${GITHUB_USER}/${GITHUB_REPO} -p "OpenMS-App.zip" -D /app; \
256259
else \
257-
echo "GH_TOKEN is not set, skipping the release asset download."; \
260+
echo "No token, skipping download."; \
258261
fi
259262

260263

Dockerfile.arm

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ ARG OPENMS_BRANCH=FVdeploy
3232
ARG PORT=8501
3333
# GitHub token to download latest OpenMS executable for Windows from Github action artifact.
3434
ARG GITHUB_TOKEN
35-
ENV GH_TOKEN=${GITHUB_TOKEN}
3635
# Streamlit app Gihub user name (to download artifact from).
3736
ARG GITHUB_USER=OpenMS
3837
# Streamlit app Gihub repository name (to download artifact from).
@@ -192,7 +191,7 @@ service cron start\n\
192191
\n\
193192
# Start Redis server in background\n\
194193
echo "Starting Redis server..."\n\
195-
redis-server --daemonize yes --dir /var/lib/redis --appendonly no\n\
194+
redis-server --daemonize yes --dir /var/lib/redis --appendonly no --ignore-warnings ARM64-COW-BUG\n\
196195
\n\
197196
# Wait for Redis to be ready\n\
198197
until redis-cli ping > /dev/null 2>&1; do\n\
@@ -252,11 +251,15 @@ RUN mamba run -n streamlit-env python hooks/hook-analytics.py
252251
RUN jq '.online_deployment = true' settings.json > tmp.json && mv tmp.json settings.json
253252

254253
# Download latest OpenMS App executable as a ZIP file
255-
RUN if [ -n "$GH_TOKEN" ]; then \
256-
echo "GH_TOKEN is set, proceeding to download the release asset..."; \
257-
gh release download -R ${GITHUB_USER}/${GITHUB_REPO} -p "OpenMS-App.zip" -D /app; \
254+
# Re-declare ARGs needed in this stage (ARGs don't persist across FROM)
255+
ARG GITHUB_TOKEN
256+
ARG GITHUB_USER=OpenMS
257+
ARG GITHUB_REPO=FLASHApp
258+
RUN if [ -n "$GITHUB_TOKEN" ]; then \
259+
echo "Downloading release asset..."; \
260+
GH_TOKEN="$GITHUB_TOKEN" gh release download -R ${GITHUB_USER}/${GITHUB_REPO} -p "OpenMS-App.zip" -D /app; \
258261
else \
259-
echo "GH_TOKEN is not set, skipping the release asset download."; \
262+
echo "No token, skipping download."; \
260263
fi
261264

262265

0 commit comments

Comments
 (0)