Skip to content

Commit

Permalink
build(Dockerfiles): Adding dockerfiles to the project
Browse files Browse the repository at this point in the history
  • Loading branch information
gabszs committed Sep 14, 2024
1 parent 685b0ed commit b9cce37
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 10 deletions.
12 changes: 2 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ ENV POETRY_NO_INTERACTION=1 \
WORKDIR app/

COPY pyproject.toml poetry.lock ./

#RUN touch README.md

RUN --mount=type=cache,target=$POETRY_CACHE_DIR poetry install --without dev --no-root

FROM python:3.11-slim-buster as runtime
Expand All @@ -28,10 +25,5 @@ COPY alembic.ini ./
COPY migrations ./migrations
COPY entrypoint.sh ./

#RUN alembic init migrations \
# && alembic revision --autogenerate \
# && alembic upgrade head

EXPOSE 8000
CMD ["uvicorn", "--host", "0.0.0.0", "app.main:app"]
#ENTRYPOINT ["python", "-m", "app.app"]
EXPOSE 5000
CMD ["uvicorn", "--host", "0.0.0.0", "--port", "5000", "app.main:app"]
39 changes: 39 additions & 0 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
FROM python:3.11-buster as builder

RUN pip install poetry==1.4.2

ENV POETRY_NO_INTERACTION=1 \
POETRY_VIRTUALENVS_IN_PROJECT=1 \
POETRY_VIRTUALENVS_CREATE=1 \
POETRY_CACHE_DIR=/tmp/poetry_cache

WORKDIR app/

COPY pyproject.toml poetry.lock ./

#RUN touch README.md

RUN --mount=type=cache,target=$POETRY_CACHE_DIR poetry install --without dev --no-root
RUN poetry add pytest

FROM python:3.11-slim-buster as runtime

ENV VIRTUAL_ENV=/app/.venv \
PATH="/app/.venv/bin:$PATH"

COPY --from=builder ${VIRTUAL_ENV} ${VIRTUAL_ENV}

COPY .env ./
COPY app ./app
COPY alembic.ini ./
COPY migrations ./migrations
COPY entrypoint.sh ./
COPY tests ./tests
RUN chmod +x ./entrypoint.sh

#RUN alembic init migrations \
# && alembic revision --autogenerate \
# && alembic upgrade head

EXPOSE 8000
# CMD ["uvicorn", "--host", "0.0.0.0", "app.main:app"]

0 comments on commit b9cce37

Please sign in to comment.