Skip to content

Commit

Permalink
feat: improve Docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
egvimo committed Oct 31, 2023
1 parent cd62a74 commit 74e42f9
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,24 @@
FROM python:3.11-bookworm
FROM python:3.11-bookworm as build

RUN apt update && apt install -y libapt-pkg-dev && \
rm -rf /var/lib/apt/lists/* && \
ENV PIPENV_VENV_IN_PROJECT=1

RUN apt update && \
apt install -y libapt-pkg-dev && \
pip install pipenv

WORKDIR /app
WORKDIR /build

COPY Pipfile Pipfile.lock ./

COPY Pipfile Pipfile.lock app.py apt_info.py ./
RUN pipenv sync

FROM build

WORKDIR /app

RUN pipenv install --deploy --ignore-pipfile
COPY --from=build /build/.venv/ ./.venv/
COPY app.py apt_info.py ./

EXPOSE 8000

CMD ["pipenv", "run", "uvicorn", "app:app", "--host", "0.0.0.0", "--no-access-log"]
CMD ["/app/.venv/bin/uvicorn", "app:app", "--host", "0.0.0.0", "--no-access-log"]

0 comments on commit 74e42f9

Please sign in to comment.