-
Notifications
You must be signed in to change notification settings - Fork 5
/
Dockerfile
67 lines (54 loc) · 2.25 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
##################
# BUILDER PYTHON #
##################
FROM python:3.8.1-slim as python-builder
# Set build variables
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
WORKDIR /usr/src/app
COPY MANIFEST.in setup.py setup.cfg requirements.txt ./
COPY gens gens/
RUN apt-get update && \
apt-get upgrade -y && \
apt-get install -y --no-install-recommends python3-pip \
python3-wheel && \
pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir gunicorn && \
pip wheel --no-cache-dir --no-deps --wheel-dir /usr/src/app/wheels \
--requirement requirements.txt
################
# BUILDER NODE #
################
FROM node:20.8.1-alpine as node-builder
WORKDIR /usr/src/app
COPY package.json package-lock.json webpack.config.js gulpfile.js ./
COPY assets assets
RUN npm install && npm run build
#########
# FINAL #
#########
FROM python:3.8.1-slim
LABEL base_image="python:3.8.1-slim"
LABEL about.home="https://github.com/Clinical-Genomics-Lund/Gens"
# Run commands as non-root user
RUN useradd -m app && mkdir -p /home/app/app
WORKDIR /home/app/app
# Copy pyhon wheels and install software
COPY --from=python-builder /usr/src/app/wheels /wheels
RUN apt-get update && \
apt-get install -y ssh sshfs && \
pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir /wheels/* && \
rm -rf /var/lib/apt/lists/* && \
rm -rf /wheels
# Chown all the files to the app user
COPY gens gens
COPY utils utils
# copy compiled web assetes
COPY --from=node-builder /usr/src/app/build/css/error.min.css gens/static/css/
COPY --from=node-builder /usr/src/app/build/css/home.min.css /usr/src/app/build/css/about.min.css gens/blueprints/home/static/
COPY --from=node-builder /usr/src/app/build/*/gens.min.* gens/blueprints/gens/static/
# make mountpoints and change ownership of app
RUN mkdir -p /access /fs1/results /fs1/results_dev && chown -R app:app /home/app/app /access /fs1 /fs1/results_dev
# Change the user to app
USER app