-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
48 lines (37 loc) · 1.06 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
FROM python:3.8-slim
# Copy over the requirements.txt file
COPY requirements.txt /requirements.txt
# Install system dependencies
RUN apt-get update -y \
&& apt-get install --no-install-recommends -y \
gcc \
default-libmysqlclient-dev \
python3.8-dev \
python3-pip \
nodejs npm \
gettext-base \
bash \
&& CRYPTOGRAPHY_DONT_BUILD_RUST=1 pip3 install --no-cache-dir -r /requirements.txt \
&& apt-get clean \
&& rm -rf /var/cache/apt /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Install app
COPY . /app
# Define $HOME
ENV HOME /app
# make sure all messages always reach console
ENV PYTHONUNBUFFERED=1
# Working dir inside the app
WORKDIR /app
# Node
RUN npm ci && npm run build
# Expose port 5000 for uvicorn
EXPOSE 5000
# Creates a non-root user and adds permission to access the /app folder
#
RUN useradd --create-home appuser \
&& chown -R appuser /app
USER appuser
# Make settings persitent (https://stackoverflow.com/a/26145444/433627)
VOLUME ["/app"]
# Run API
ENTRYPOINT ["/app/entrypoint.sh"]