Updated Dockerfile with smaller images
This commit is contained in:
parent
1c652f2727
commit
1748639b43
1 changed files with 13 additions and 6 deletions
19
Dockerfile
19
Dockerfile
|
@ -1,18 +1,25 @@
|
||||||
FROM python:3.10 as build
|
FROM python:3.10-slim as build
|
||||||
|
|
||||||
WORKDIR /tmp
|
WORKDIR /tmp
|
||||||
|
|
||||||
RUN pip install poetry
|
RUN pip install poetry
|
||||||
COPY ./pyproject.toml ./poetry.lock* /tmp/
|
COPY ./pyproject.toml ./poetry.lock* /tmp/
|
||||||
RUN poetry export -f requirements.txt --output requirements.txt --without-hashes
|
RUN poetry export -f requirements.txt --output requirements.txt --without-hashes --without dev
|
||||||
|
|
||||||
FROM python:3.10
|
ENV VIRTUAL_ENV=/opt/venv
|
||||||
|
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
|
||||||
|
RUN python -m venv $VIRTUAL_ENV && \
|
||||||
|
pip install --no-cache-dir --upgrade -r requirements.txt
|
||||||
|
|
||||||
|
FROM python:3.10-alpine
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
COPY --from=build /tmp/requirements.txt /code/requirements.txt
|
ENV VIRTUAL_ENV=/opt/venv
|
||||||
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
|
||||||
|
|
||||||
|
COPY --from=build $VIRTUAL_ENV $VIRTUAL_ENV
|
||||||
|
|
||||||
COPY resa_padel/ /app/
|
COPY resa_padel/ /app/
|
||||||
|
|
||||||
CMD python .
|
CMD python .
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue