Skip to content

Commit d6d4c20

Browse files
authored
Merge pull request ricklamers#49 from pyhp2017/dev
Fix port-forward & Add Multistage Dockerfile
2 parents 859255a + 8e4e7d4 commit d6d4c20

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

Dockerfile

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,22 @@
1-
FROM python:3.8-slim-buster
1+
# Build stage
2+
FROM python:3.8-alpine AS build
23

34
WORKDIR /app
45

56
COPY requirements.txt requirements.txt
6-
RUN pip3 install -r requirements.txt
7+
RUN apk add --no-cache build-base && \
8+
pip3 install --user --no-cache-dir -r requirements.txt
79

810
COPY . .
911

12+
# Production stage
13+
FROM python:3.8-alpine AS production
14+
15+
WORKDIR /app
16+
17+
COPY --from=build /root/.local /root/.local
18+
COPY . .
19+
20+
ENV PATH=/root/.local/bin:$PATH
21+
1022
CMD ["python3", "./run.py"]

0 commit comments

Comments
 (0)