-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathunit.Dockerfile
More file actions
54 lines (41 loc) · 1.33 KB
/
unit.Dockerfile
File metadata and controls
54 lines (41 loc) · 1.33 KB
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
44
45
46
47
48
49
50
51
52
53
54
FROM unit:1.34.1-python3.13-slim
LABEL authors="MarcLandis"
# `WEBHOOKFEEDS_ENV` arg is used to make prod / dev builds:
ARG WEBHOOKFEEDS_ENV
ENV WEBHOOKFEEDS_ENV=${WEBHOOKFEEDS_ENV} \
# python:
PYTHONFAULTHANDLER=1 \
PYTHONUNBUFFERED=1 \
PYTHONHASHSEED=random \
PYTHONDONTWRITEBYTECODE=1 \
# pip:
PIP_NO_CACHE_DIR=1 \
PIP_DISABLE_PIP_VERSION_CHECK=1 \
PIP_DEFAULT_TIMEOUT=100 \
PIP_ROOT_USER_ACTION=ignore \
# poetry:
POETRY_VERSION=2.0.1 \
POETRY_VIRTUALENVS_CREATE=false \
POETRY_CACHE_DIR='/var/cache/pypoetry' \
POETRY_HOME='/usr/local' \
# fastapi:
URL_SUBFOLDER='/api'
SHELL ["/bin/bash", "-eo", "pipefail", "-c"]
RUN apt-get update && apt-get install -y --no-install-recommends \
curl \
libpq-dev \
&& rm -rf /var/lib/apt/lists/*
RUN curl -sSL 'https://install.python-poetry.org' | python -
WORKDIR /usr/src
COPY ./poetry.lock ./pyproject.toml /usr/src/
COPY ./LICENSE.md /usr/src/LICENSE.md
COPY ./README.md /usr/src/README.md
COPY ./.assets /usr/src/.assets
RUN --mount=type=cache,target="$POETRY_CACHE_DIR" \
poetry sync \
$(if [ "$WEBHOOKFEEDS_ENV" = 'production' ]; then echo '--only main'; fi) \
--no-interaction --no-ansi
COPY ./app /usr/src/app
COPY ./config.json /docker-entrypoint.d/config.json
RUN chown -R unit:unit /usr/src/
EXPOSE 80