-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
43 lines (30 loc) · 952 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
FROM python:3.10-slim
ENV PYTHONUNBUFFERED 1
ENV UVICORN_CMD_ARGS ""
EXPOSE 8000
# Install system-wide dependencies
RUN apt-get update && \
apt-get install --no-install-recommends -y git curl gcc python3-dev && \
apt-get clean autoclean && \
apt-get autoremove --yes && \
rm -rf /var/lib/apt/lists/*
# Create user for app
ENV APP_USER=appuser
RUN useradd --create-home $APP_USER
WORKDIR /home/$APP_USER
USER $APP_USER
# Use venv directly via PATH
ENV VENV_PATH=/home/$APP_USER/.venv/bin
ENV USER_PATH=/home/$APP_USER/.local/bin
ENV PATH="$VENV_PATH:$USER_PATH:$PATH"
RUN pip install --user --no-cache-dir poetry==1.3.1 && \
poetry config virtualenvs.in-project true
COPY poetry.lock pyproject.toml ./
RUN poetry install --no-dev
COPY alembic.ini .
COPY app app
RUN mkdir ./file_storage
ARG CI_COMMIT_SHA=""
ENV GIT_COMMIT_SHA=${CI_COMMIT_SHA}
CMD alembic upgrade head && \
uvicorn --host=0.0.0.0 $UVICORN_CMD_ARGS app.main:app