multi-stage builds
This commit is contained in:
parent
4c6133f9a8
commit
042ca22c3d
1 changed files with 13 additions and 7 deletions
20
Dockerfile
20
Dockerfile
|
@ -1,13 +1,19 @@
|
||||||
FROM python:3.11-alpine
|
FROM python:3.11-alpine as pybuilder
|
||||||
|
|
||||||
RUN sed -i 's|v3\.\d*|edge|' /etc/apk/repositories
|
RUN sed -i 's|v3\.\d*|edge|' /etc/apk/repositories
|
||||||
|
RUN apk update && apk add --no-cache olm-dev gcc musl-dev tzdata
|
||||||
|
COPY requirements.txt /requirements.txt
|
||||||
|
RUN pip3 install --user -r /requirements.txt && rm /requirements.txt
|
||||||
|
|
||||||
RUN apk add olm-dev gcc musl-dev
|
|
||||||
|
|
||||||
COPY ./ /app
|
FROM python:3.11-alpine as runner
|
||||||
|
RUN apk update && apk add --no-cache olm-dev
|
||||||
|
COPY --from=pybuilder /root/.local /usr/local
|
||||||
|
COPY --from=pybuilder /usr/share/zoneinfo /usr/share/zoneinfo
|
||||||
|
COPY . /app
|
||||||
|
|
||||||
|
|
||||||
|
FROM runner
|
||||||
|
ENV TZ=Asia/Shanghai
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
CMD ["python", "main.py"]
|
||||||
|
|
||||||
RUN pip install -r requirements.txt
|
|
||||||
|
|
||||||
ENTRYPOINT python main.py
|
|
||||||
|
|
Loading…
Reference in a new issue