-
Notifications
You must be signed in to change notification settings - Fork 18
/
Dockerfile
40 lines (30 loc) · 1.32 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
FROM python:3.6-slim
WORKDIR /app/
RUN groupadd --gid 10001 app && useradd -g app --uid 10001 --shell /usr/sbin/nologin app
RUN apt-get update && \
apt-get install -y gcc apt-transport-https curl gnupg
# Install Node and Yarn
RUN curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add - && \
echo 'deb https://deb.nodesource.com/node_10.x stretch main' > /etc/apt/sources.list.d/nodesource.list && \
echo 'deb-src https://deb.nodesource.com/node_10.x stretch main' >> /etc/apt/sources.list.d/nodesource.list && \
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \
echo 'deb https://dl.yarnpkg.com/debian/ stable main' > /etc/apt/sources.list.d/yarn.list && \
apt-get update && \
apt-get install -y nodejs yarn
COPY ./requirements.txt /app/requirements.txt
COPY ./requirements-constraints.txt /app/requirements-constraints.txt
COPY ./package.json /app/package.json
COPY ./yarn.lock /app/yarn.lock
RUN pip install -U 'pip>=8' && \
pip install --no-cache-dir -r requirements.txt --progress-bar off && \
yarn install --non-interactive --prod
# Install the app
COPY . /app/
RUN yarn build --prod
# Set Python-related environment variables to reduce annoying-ness
ENV PYTHONUNBUFFERED 1
ENV PYTHONDONTWRITEBYTECODE 1
ENV PORT 5000
USER app
EXPOSE $PORT
CMD python app.py