Skip to content
This repository was archived by the owner on Oct 20, 2024. It is now read-only.

Commit 51a6e82

Browse files
committed
docker two state build
1 parent 15e985c commit 51a6e82

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

Dockerfile

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
1-
FROM python:3-alpine
1+
# Builder
2+
FROM python:3.8-slim as builder
23

3-
WORKDIR /app
4+
COPY ./requirements.txt ./
5+
6+
RUN apt update \
7+
&& apt install -y --no-install-recommends build-essential \
8+
&& pip3 install --user -r requirements.txt
49

5-
COPY . /app
10+
# Executor
11+
FROM python:3.8-slim
12+
13+
WORKDIR /app
614

7-
RUN apk update \
8-
&& apk add build-base raspberrypi \
9-
&& pip3 install --trusted-host pypi.python.org -r requirements.txt \
10-
&& apk del --purge build-base \
11-
&& rm -rf /var/cache/apk/*
15+
COPY --from=builder /root/.local /root/.local
16+
COPY ./fan.py ./
1217

13-
CMD ["python3", "-u", "fan.py"]
18+
CMD ["python", "-u", "./fan.py"]

0 commit comments

Comments
 (0)