Skip to content

Commit 2c5fa6b

Browse files
committed
minor changes in CI/CD
1 parent b85e7b4 commit 2c5fa6b

File tree

2 files changed

+49
-58
lines changed

2 files changed

+49
-58
lines changed

.github/workflows/quantms-rescoring-containers.yml

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,13 @@ jobs:
3636
RETRY_DELAY: 30
3737

3838
steps:
39+
- name: Free up disk space before build
40+
run: |
41+
sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc
42+
docker system prune -af || true
43+
sudo apt-get clean
44+
sudo rm -rf /var/lib/apt/lists/*
45+
3946
- name: Checkout repository
4047
uses: actions/checkout@v4
4148

@@ -55,7 +62,6 @@ jobs:
5562
VERSION=$(grep '^version = ' pyproject.toml | cut -d'"' -f2)
5663
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
5764
echo "Extracted version: $VERSION"
58-
5965
# Extract major and minor version
6066
MAJOR=$(echo $VERSION | cut -d'.' -f1)
6167
MINOR=$(echo $VERSION | cut -d'.' -f2)
@@ -77,6 +83,12 @@ jobs:
7783
# Note: Only building for linux/amd64 as pyopenms doesn't have ARM64 wheels
7884
platforms: linux/amd64
7985

86+
- name: Free up disk space after build
87+
run: |
88+
docker system prune -af || true
89+
sudo apt-get clean
90+
sudo rm -rf /var/lib/apt/lists/*
91+
8092
- name: Set up Singularity
8193
if: ${{ (github.event.inputs.push_images == true || github.event.inputs.push_images == '') }}
8294
uses: eWaterCycle/setup-singularity@v7
@@ -86,17 +98,13 @@ jobs:
8698
- name: Pull Docker image for Singularity conversion
8799
if: ${{ (github.event.inputs.push_images == true || github.event.inputs.push_images == '') }}
88100
run: |
89-
# Pull the Docker image from GitHub Container Registry
90101
docker pull ghcr.io/bigbio/quantms-rescoring:latest
91-
# Save the Docker image to a tar file
92102
docker save ghcr.io/bigbio/quantms-rescoring:latest -o quantms-rescoring.tar
93103
94104
- name: Convert Docker image to Singularity
95105
if: ${{ (github.event.inputs.push_images == true || github.event.inputs.push_images == '') }}
96106
run: |
97-
# Convert Docker tar to Singularity SIF
98107
singularity build quantms-rescoring.sif docker-archive://quantms-rescoring.tar
99-
# Verify the SIF file exists
100108
ls -la quantms-rescoring.sif
101109
102110
- name: Login and Deploy Container
@@ -105,11 +113,7 @@ jobs:
105113
IS_RELEASE: ${{ github.event_name == 'release' }}
106114
run: |
107115
echo ${{ secrets.GHCR_TOKEN }} | singularity remote login -u ${{ secrets.GHCR_USERNAME }} --password-stdin oras://ghcr.io
108-
109-
# Push with exact version tag
110116
singularity push quantms-rescoring.sif oras://ghcr.io/bigbio/quantms-rescoring-sif:${{ steps.version.outputs.VERSION }}
111-
112-
# If this is a release event, also tag as latest
113117
if [[ "${{ env.IS_RELEASE }}" == "true" || "${{ github.event_name }}" == "release" ]]; then
114118
singularity push quantms-rescoring.sif oras://ghcr.io/bigbio/quantms-rescoring-sif:latest
115119
fi

Dockerfile

Lines changed: 36 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,74 +1,61 @@
1-
FROM ubuntu:22.04
2-
3-
# Some metadata
4-
LABEL base_image="ubuntu:22.04"
5-
LABEL version="1"
6-
LABEL software="quantms-rescoring"
7-
LABEL software.version="0.0.11"
8-
LABEL about.summary="quantms-rescoring: Python scripts and helpers for the quantMS workflow"
9-
LABEL about.home="https://github.com/bigbio/quantms-rescoring"
10-
LABEL about.documentation="https://github.com/bigbio/quantms-rescoring"
11-
LABEL about.license_file="https://github.com/bigbio/quantms-rescoring/blob/main/LICENSE"
12-
LABEL about.tags="Proteomics,MS2PIP,DeepLC,OpenMS"
13-
LABEL maintainer="Yasset Perez-Riverol <ypriverol@gmail.com>"
1+
# ===================
2+
# Stage 1: Build
3+
# ===================
4+
FROM python:3.11-slim as builder
145

156
ENV DEBIAN_FRONTEND=noninteractive
167

17-
# Update package lists and install necessary packages in a single RUN command
188
RUN apt-get update && apt-get install -y --no-install-recommends \
19-
python3.11 \
9+
build-essential \
2010
python3.11-dev \
2111
python3.11-venv \
22-
python3-pip \
23-
build-essential \
24-
curl \
25-
git \
26-
wget \
27-
locales \
28-
# pyOpenMS dependencies
2912
libglib2.0-0 \
3013
libgomp1 \
31-
# Additional dependencies for proteomics tools
3214
libboost-all-dev \
3315
libhdf5-dev \
3416
libnetcdf-dev \
3517
libxml2-dev \
3618
libxslt1-dev \
3719
libssl-dev \
3820
libffi-dev && \
39-
# Configure locale
40-
locale-gen en_US.UTF-8 && \
41-
update-locale LANG=en_US.UTF-8 && \
42-
# Clean up package cache
43-
apt-get clean && \
44-
rm -rf /var/lib/apt/lists/*
21+
apt-get clean && rm -rf /var/lib/apt/lists/*
4522

46-
# Set environment variables for locale
47-
ENV LANG=en_US.UTF-8
48-
ENV LANGUAGE=en_US:en
49-
ENV LC_ALL=en_US.UTF-8
50-
51-
# Set work directory
5223
WORKDIR /app
53-
54-
# Copy application code first
5524
COPY . .
5625

57-
# Install Poetry and dependencies using the same strategy as CI/CD
58-
RUN python3.11 -m pip install --upgrade pip && \
59-
python3.11 -m pip install flake8==7.3.0 pytest==8.4.1 && \
60-
python3.11 -m pip install -r requirements.txt && \
61-
python3.11 -m pip install poetry==2.1.3 && \
26+
RUN pip install --no-cache-dir --upgrade pip && \
27+
pip install --no-cache-dir poetry==2.1.3 && \
6228
poetry build && \
63-
python3.11 -m pip install dist/*.whl && \
64-
python3.11 -m pip cache purge
29+
pip install --no-cache-dir dist/*.whl && \
30+
pip cache purge
6531

66-
# Test pyOpenMS import
67-
RUN python3.11 -c "import pyopenms; print('pyOpenMS imported successfully')"
32+
# ===================
33+
# Stage 2: Runtime
34+
# ===================
35+
FROM python:3.11-slim as final
36+
37+
ENV DEBIAN_FRONTEND=noninteractive
38+
ENV LANG=en_US.UTF-8
39+
ENV LANGUAGE=en_US:en
40+
ENV LC_ALL=en_US.UTF-8
41+
42+
RUN apt-get update && apt-get install -y --no-install-recommends \
43+
libglib2.0-0 \
44+
libgomp1 \
45+
libhdf5-103-1 \
46+
libnetcdf19 \
47+
libxml2 \
48+
libxslt1.1 \
49+
libssl3 \
50+
libffi8 && \
51+
apt-get clean && rm -rf /var/lib/apt/lists/*
52+
53+
COPY --from=builder /usr/local /usr/local
6854

69-
# Create a non-root user
7055
RUN useradd --create-home --shell /bin/bash app && \
71-
chown -R app:app /app
56+
mkdir /data && chown -R app:app /data
7257
USER app
7358

74-
WORKDIR /data/
59+
WORKDIR /data
60+
61+
RUN python3.11 -c "import pyopenms; print('pyOpenMS imported successfully')"

0 commit comments

Comments
 (0)