-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.server
More file actions
53 lines (39 loc) · 1.51 KB
/
Dockerfile.server
File metadata and controls
53 lines (39 loc) · 1.51 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
FROM jchavas/brainvisa-aims:latest
###############################
# 1. Install packages as root #
###############################
RUN apt-get update \
&& apt-get install -y --no-install-recommends --no-install-suggests \
python3 \
python3-pip \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Upgrade pip as recommended
RUN python3 -m pip install --no-cache-dir --upgrade pip
# Setuptools is needed to import from source, wheel to build/install the
# package
RUN python3 -m pip install --no-cache-dir setuptools wheel
RUN python3 -m pip install --no-cache-dir gunicorn[gevent]
# to deal with non-ASCII characters in source
ENV LANG=C.UTF-8
COPY . /source
RUN python3 -m pip install --no-cache-dir /source
######################
# 2. Configure paths #
######################
ENV INSTANCE_PATH /instance
ENV TRANSFORMATION_DATA_PATH /transformation-data
VOLUME ${INSTANCE_PATH}
###########################################################
# 3. Create an unprivileged user that will run the server #
###########################################################
RUN useradd --create-home user
RUN mkdir -p ${INSTANCE_PATH} && chown user:user ${INSTANCE_PATH}
RUN mkdir -p ${TRANSFORMATION_DATA_PATH} && chown user:user ${TRANSFORMATION_DATA_PATH}
USER user
###########################
# 4. Configure the server #
###########################
ENV FLASK_APP hbp_spatial_backend
EXPOSE 8080
CMD gunicorn --access-logfile=- --preload 'hbp_spatial_backend.wsgi:application' --bind=:8080 --worker-class=gevent