feat/docker support
This commit is contained in:
parent
579e837a49
commit
e32310da73
2 changed files with 37 additions and 0 deletions
35
Dockerfile
Normal file
35
Dockerfile
Normal file
|
@ -0,0 +1,35 @@
|
|||
FROM python:3.11-slim as python-base
|
||||
ENV PYTHONUNBUFFERED=1 \
|
||||
PYTHONDONTWRITEBYTECODE=1 \
|
||||
POETRY_HOME="/opt/poetry" \
|
||||
POETRY_VIRTUALENVS_IN_PROJECT=true \
|
||||
POETRY_NO_INTERACTION=1 \
|
||||
PYSETUP_PATH="/opt/venv" \
|
||||
VENV_PATH="/opt/venv/.venv"
|
||||
ENV PATH="$POETRY_HOME/bin:$VENV_PATH/bin:$PATH"
|
||||
|
||||
FROM python-base as builder-base
|
||||
RUN apt-get update && \
|
||||
apt-get install -y --no-install-recommends \
|
||||
curl build-essential gcc libffi-dev libssl-dev \
|
||||
libxml2-dev libxslt1-dev zlib1g-dev libxslt-dev \
|
||||
gcc libjpeg-dev zlib1g-dev libwebp-dev
|
||||
|
||||
RUN curl -sSL https://install.python-poetry.org | python3 -
|
||||
WORKDIR $PYSETUP_PATH
|
||||
COPY poetry.lock pyproject.toml ./
|
||||
RUN poetry install
|
||||
|
||||
FROM python-base as production
|
||||
RUN apt-get update && \
|
||||
apt-get install -y --no-install-recommends \
|
||||
libjpeg-dev libxslt1-dev libxml2-dev libxslt-dev
|
||||
COPY --from=builder-base /opt /opt
|
||||
COPY . /app/
|
||||
RUN groupadd --gid 1000 foxhole \
|
||||
&& useradd --uid 1000 --gid foxhole --shell /bin/bash foxhole
|
||||
RUN chown -R 1000:1000 /app
|
||||
USER foxhole
|
||||
WORKDIR /app
|
||||
EXPOSE 7000
|
||||
CMD ["./misc/start.sh"]
|
2
misc/start.sh
Executable file
2
misc/start.sh
Executable file
|
@ -0,0 +1,2 @@
|
|||
#!/bin/sh
|
||||
uvicorn app.main:app --port 7000
|
Loading…
Reference in a new issue