-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
47 lines (37 loc) · 1.38 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
FROM python:3.10-slim
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get upgrade -y \
gcc \
libnetcdf-dev \
#libhdf5-dev \
#hdf5-helpers \
&& pip3 install --upgrade pip \
&& pip3 install cython \
&& pip3 install poetry \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
# Create a new user
RUN adduser --quiet --disabled-password --shell /bin/sh --home /home/dockeruser --gecos "" --uid 1000 dockeruser
USER dockeruser
ENV HOME /home/dockeruser
ENV PYTHONPATH "${PYTHONPATH}:/home/dockeruser/.local/bin"
ENV PATH="/home/dockeruser/.local/bin:${PATH}"
# The 'SOURCE' argument is what will be used in 'pip install'.
ARG SOURCE
# Set this argument if running the pip install on a local directory, so
# the local dist files are copied into the container.
ARG DIST_PATH
USER root
RUN mkdir -p /worker && chown dockeruser /worker
COPY pyproject.toml /worker
WORKDIR /worker
# ENV PYTHONPATH=${PYTHONPATH}:${PWD}
COPY --chown=dockeruser $DIST_PATH $DIST_PATH
#RUN pip3 install --no-cache-dir --force --user --index-url https://pypi.org/simple/ --extra-index-url https://test.pypi.org/simple/ $SOURCE \
# && rm -rf $DIST_PATH
#install poetry as root
RUN poetry config virtualenvs.create false
RUN poetry install --only main
USER dockeruser
COPY --chown=dockeruser ./docker-entrypoint.sh docker-entrypoint.sh
# Run the service
ENTRYPOINT ["./docker-entrypoint.sh"]