Skip to content

Commit

Permalink
Fix docker
Browse files Browse the repository at this point in the history
  • Loading branch information
mhrimaz committed Jan 21, 2024
1 parent fc72da4 commit 3f41bb4
Showing 1 changed file with 4 additions and 16 deletions.
20 changes: 4 additions & 16 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,29 +1,17 @@
FROM python:3.11-alpine as builder
FROM python:3.11-slim as base

RUN adduser -D nonroot
USER nonroot
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1

WORKDIR /app

COPY requirements.txt .
RUN pip install --no-cache-dir --upgrade -r requirements.txt

FROM python:3.11-alpine

RUN adduser -D nonroot
USER nonroot

COPY --from=builder --chown=nonroot:nonroot --chmod=755 /app /app

WORKDIR /app

COPY . .

FROM base as production

EXPOSE 80

ENV PYTHONUNBUFFERED 1

HEALTHCHECK --interval=30s --timeout=15s --retries=5 --start-period=5s CMD wget --quiet --tries=2 --spider http://0.0.0.0:80/health || exit 1

CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "80"]

0 comments on commit 3f41bb4

Please sign in to comment.