Repository navigation
Expand file tree
/
Copy pathDockerfile
More file actions
61 lines (42 loc) · 1.49 KB
/
Copy pathDockerfile
File metadata and controls
61 lines (42 loc) · 1.49 KB
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
ARG AZLINUX_BASE_VERSION=master
# Base stage with python-build-base
FROM quay.io/cdis/python-nginx-al:${AZLINUX_BASE_VERSION} AS base
ENV appname=PcdcAnalysisTools
WORKDIR /${appname}
RUN chown -R gen3:gen3 /${appname}
# Builder stage
FROM base AS builder
RUN yum install -y \
gcc \
python3-devel \
postgresql-devel \
libpq-devel && \
yum clean all
# May need to uncomment this for nerdctl builds
# RUN ln -s /usr/bin/python3 /usr/bin/python || true
USER gen3
COPY --chown=gen3:gen3 . /${appname}
RUN poetry install -vv --without dev --no-interaction
RUN git config --global --add safe.directory ${appname} && COMMIT=`git rev-parse HEAD` && echo "COMMIT=\"${COMMIT}\"" > ${appname}/version_data.py \
&& VERSION=`git describe --always --tags` && echo "VERSION=\"${VERSION}\"" >> ${appname}/version_data.py
# Final stage
FROM base
# Install runtime dependencies
RUN yum install -y \
gcc \
python3-devel \
postgresql-devel \
libpq-devel && \
yum clean all
# Copy poetry artifacts and install the dependencies
COPY poetry.lock pyproject.toml /$appname/
RUN poetry config virtualenvs.create false && \
poetry install -vv --no-root --without dev --no-interaction && \
poetry show -v
# Copy application files from the builder stage
COPY --from=builder /${appname} /${appname}
# Switch to non-root user 'gen3' for the serving process
USER gen3
WORKDIR /${appname}
RUN chmod 755 /${appname}/dockerrun.bash
CMD ["/bin/bash", "-c", "/PcdcAnalysisTools/dockerrun.bash"]