Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 5cf2c08

Browse files
committedMar 4, 2025
feat(ci)🐳: Add Docker image build step to deployment workflow
- Introduced a new job in the GitHub Actions workflow to build a Docker image. - Updated the Dockerfile to use a new base image and streamlined the build process.
1 parent f187a5e commit 5cf2c08

File tree

2 files changed

+19
-24
lines changed

2 files changed

+19
-24
lines changed
 

‎.github/workflows/deploy.yaml

+11
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,17 @@ jobs:
5151
with:
5252
source-dir: ./site
5353

54+
build-docker-image:
55+
runs-on: ubuntu-latest
56+
steps:
57+
- uses: actions/checkout@v4
58+
- uses: prefix-dev/setup-pixi@v0.8.3
59+
with:
60+
pixi-version: v0.41.4
61+
cache: true
62+
- name: Build Docker image
63+
run: |
64+
docker build -t nams-docker .
5465
5566
# - name: Download environment tarball
5667
# uses: actions/download-artifact@v3

‎scripts/Dockerfile

+8-24
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,16 @@
1-
# For use with both Dokku and Binder
2-
FROM continuumio/miniconda3
1+
FROM ghcr.io/prefix-dev/pixi:0.40.0 AS build
32

3+
WORKDIR /app
4+
COPY pixi.lock /app/pixi.lock
5+
COPY pyproject.toml /app/pyproject.toml
6+
COPY nams /app/nams
47

5-
# We isolate the conda environment setup step
6-
# because it is time consuming and a bit of a RAM hog.
7-
ADD environment.yml /environment.yml
8-
RUN conda env create -f /environment.yml
9-
RUN rm /environment.yml
8+
RUN pixi install
109

11-
# We put the custom source installation steps here
12-
# and not in the `environment.yml` file
13-
# to prevent Docker from rebuilding the environment
14-
# each time the source and notebooks change (which they will).
15-
# This is extremely time consuming and expensive during the build.
16-
ADD nams /tmp/setup/nams
17-
ADD setup.py tmp/setup/setup.py
18-
WORKDIR /tmp/setup
19-
RUN python setup.py install
20-
RUN rm -rf /tmp/setup
21-
22-
# Now we add the repository to the Docker container
23-
ADD . /nams
24-
WORKDIR /nams
25-
ENV PATH="/opt/conda/envs/nams/bin:${PATH}"
26-
RUN python -m ipykernel install --name nams
10+
RUN pixi run python -m ipykernel install --user --name nams
2711

2812
# Build docs in the container in this step
29-
RUN mkdocs build
13+
RUN pixi run build-docs
3014

3115
# Run Python web server to serve up static files
3216
EXPOSE 80

0 commit comments

Comments
 (0)
Please sign in to comment.