forked from stakewise/oracle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
47 lines (35 loc) · 908 Bytes
/
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
###########
# Builder #
###########
FROM python:3.8.7-slim AS builder
# This is where pip will install to
ENV PYROOT /pyroot
# A convenience to have console_scripts in PATH
ENV PYTHONUSERBASE $PYROOT
WORKDIR /build
# Setup virtualenv
RUN python -m venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"
# Copy requirements
COPY requirements/prod.txt ./
# Install build dependencies
RUN apt-get update && \
apt-get install -y \
gcc \
&& rm -rf /var/lib/apt/lists/*
# Install dependencies
RUN pip install --upgrade --no-cache-dir pip wheel && \
pip install --require-hashes -r prod.txt
####################
# Production image #
####################
FROM python:3.8.7-slim
# Dependencies path
ENV PATH="/opt/venv/bin:$PATH"
WORKDIR /app
# Copy dependencies from build container
COPY --from=builder /opt/venv /opt/venv
# Copy source code
COPY . ./
# Start application
ENTRYPOINT ["python", "main.py"]