-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
44 lines (35 loc) · 1.67 KB
/
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
44
FROM debian:bookworm-slim
RUN mkdir -p /opt/services/djangoapp/src /opt/services/djangoapp/static
WORKDIR /opt/services/djangoapp/src
COPY pyproject.toml poetry.lock /opt/services/djangoapp/src/
ENV PATH="/opt/services/djangoapp/venv/bin:${PATH}"
ENV VIRTUAL_ENV="/opt/services/djangoapp/venv"
# dependencies
RUN apt-get update \
&& apt-get install -y build-essential libpq-dev libqpdf-dev pip xz-utils \
python3-dev python3-wheel python3-venv wget redis nginx \
&& apt-get install -y --no-install-recommends ffmpeg \
&& python3 -m venv /opt/services/djangoapp/venv \
&& pip install wheel poetry pytz && poetry config virtualenvs.create false \
&& poetry install --without dev --no-root -E reviewpanel \
&& rm -rf /var/lib/apt/lists/* /etc/nginx/sites-enabled/default \
&& apt-get purge -y --auto-remove build-essential
# virtualenvs.create option because we don't need an extra virtualenv here
COPY . /opt/services/djangoapp/src
# install the root package too
RUN poetry install --no-dev
COPY resources/s6-rc.d /etc/s6-overlay/s6-rc.d
COPY resources/nginx /etc/nginx/conf.d
COPY resources/run /opt/services/djangoapp/run
ARG S6_VERSION=3.1.0.1
ARG S6_URL=https://github.com/just-containers/s6-overlay/releases/download
RUN arch="$(dpkg --print-architecture)"; \
case "$arch" in arm64) s6arch='aarch64' ;; amd64) s6arch='x86_64' ;; esac; \
wget -O s6.tar.xz ${S6_URL}/v${S6_VERSION}/s6-overlay-noarch.tar.xz; \
wget -O s6arch.tar.xz ${S6_URL}/v${S6_VERSION}/s6-overlay-$s6arch.tar.xz; \
tar -C / -Jxpf s6.tar.xz; \
tar -C / -Jxpf s6arch.tar.xz; \
rm s6.tar.xz s6arch.tar.xz
EXPOSE 80
ENTRYPOINT ["/init"]
CMD ["/command/with-contenv", "../run"]