Skip to content

Commit df6a31a

Browse files
committed
docker: started work on dockerfile for reproducibility
1 parent 5c178f9 commit df6a31a

1 file changed

Lines changed: 52 additions & 0 deletions

File tree

docker/dockerfile

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
##########################################################
2+
# This Dockerfile can be used to run the Schism examples #
3+
##########################################################
4+
5+
# Base image with compilers
6+
ARG base=devitocodes/bases:cpu-gcc
7+
8+
FROM $base as builder
9+
10+
# Copy Schism
11+
ADD . /app/schism
12+
13+
# Install pip dependencies
14+
RUN python3 -m venv /venv && \
15+
/venv/bin/pip install --no-cache-dir --upgrade pip && \
16+
/venv/bin/pip install --no-cache-dir jupyter && \
17+
/venv/bin/pip install --no-cache-dir wheel && \
18+
/venv/bin/pip install -r /app/schism/requirements.txt
19+
20+
# Upgrade python in venv
21+
RUN python3 -m venv --upgrade /venv
22+
23+
# Install Schism as a pip package
24+
WORKDIR /app/schism
25+
RUN /venv/bin/pip install --no-cache-dir -e . && \
26+
rm -rf ~/.cache/pip
27+
28+
WORKDIR /~
29+
# Safety cleanup
30+
RUN apt-get clean && apt-get autoclean && apt-get autoremove && \
31+
rm -rf /var/lib/apt/lists/*
32+
33+
FROM $base as user
34+
35+
# Create app user
36+
# Set the home directory as out app user's home
37+
ENV HOME=/app
38+
ENV APP_HOME=/app
39+
40+
RUN mkdir -p /app && groupadd -r app && \
41+
useradd -r -g app -d /app -s /sbin/nologin -c "Docker image user" app && \
42+
chown -R app:app $APP_HOME
43+
44+
COPY --from=builder --chown=app:app /app /app
45+
46+
# Venv
47+
COPY --from=builder --chown=app:app /venv /venv
48+
49+
# Change to the app user
50+
USER app
51+
52+
EXPOSE 8888

0 commit comments

Comments
 (0)