forked from FNNDSC/pman
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
executable file
·71 lines (61 loc) · 2.4 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
68
69
70
71
#
# Docker file for pman image
#
# Build production image:
#
# docker build -t <name> .
#
# For example if building a local production image:
#
# docker build -t local/pman .
#
# Build development image:
#
# docker build --build-arg ENVIRONMENT=local -t <name>:<tag> .
#
# For example if building a local development image:
#
# docker build --build-arg ENVIRONMENT=local -t local/pman:dev .
#
# In the case of a proxy (located at say proxy.tch.harvard.edu:3128), do:
#
# export PROXY="http://proxy.tch.harvard.edu:3128"
#
# then add to any of the previous build commands:
#
# --build-arg http_proxy=${PROXY}
#
# For example if building a local development image:
#
# docker build --build-arg http_proxy=${PROXY} --build-arg ENVIRONMENT=local -t local/pman:dev .
#
FROM fnndsc/ubuntu-python3:ubuntu20.04-python3.8.5
MAINTAINER fnndsc "[email protected]"
# Pass a UID on build command line (see above) to set internal UID
ARG UID=1001
ARG ENVIRONMENT=production
ENV UID=$UID DEBIAN_FRONTEND=noninteractive VERSION="0.1"
ENV APPROOT="/home/localuser/pman" REQPATH="/usr/src/requirements"
RUN apt-get update \
&& apt-get install -y locales \
&& export LANGUAGE=en_US.UTF-8 \
&& export LANG=en_US.UTF-8 \
&& export LC_ALL=en_US.UTF-8 \
&& locale-gen en_US.UTF-8 \
&& dpkg-reconfigure locales \
&& apt-get install -y gunicorn \
&& useradd -u $UID -ms /bin/bash localuser
COPY ["./requirements", "${REQPATH}"]
# Copy source code and make localuser the owner
COPY --chown=localuser ./bin ${APPROOT}/bin
COPY --chown=localuser ./pman ${APPROOT}/pman
COPY --chown=localuser ./setup.cfg ./setup.py README.rst ${APPROOT}/
RUN pip install --upgrade pip \
&& pip install -r ${REQPATH}/${ENVIRONMENT}.txt
# Start as user localuser
#USER localuser
WORKDIR ${APPROOT}
ENTRYPOINT []
EXPOSE 5010
# Start pman production server
CMD ["gunicorn", "-w", "5", "-b", "0.0.0.0:5010", "pman.wsgi:application"]