-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathDockerfile
More file actions
40 lines (25 loc) · 738 Bytes
/
Dockerfile
File metadata and controls
40 lines (25 loc) · 738 Bytes
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
#
# Intermediate Compile Image
#
FROM python:3-alpine AS compile-image
RUN apk add --no-cache build-base
RUN python -m venv /opt/venv
# Basically this is everything import <venv>/bin/activate does
ENV PATH="/opt/venv/bin:$PATH"
COPY requirements.txt .
RUN pip install -r requirements.txt
#
# Final Build Image
#
FROM python:3-alpine AS build-image
COPY --from=compile-image /opt/venv /opt/venv
WORKDIR /cameraobscura
RUN apk add --no-cache shadow; \
groupadd -r obscura && useradd -r -g obscura -d /cameraobscura -s /sbin/nologin -c "Docker image user" obscura; \
chown -R obscura:obscura .; \
apk del --no-cache shadow
USER obscura
COPY . .
EXPOSE 8080
ENTRYPOINT [ "/opt/venv/bin/python3" ]
CMD [ "main.py" ]