-
Notifications
You must be signed in to change notification settings - Fork 603
/
Dockerfile.cabotage
49 lines (42 loc) · 1.78 KB
/
Dockerfile.cabotage
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
FROM python:3.12.6-bookworm
COPY --from=ewdurbin/nginx-static:1.25.x /usr/bin/nginx /usr/bin/nginx
ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1
# By default, Docker has special steps to avoid keeping APT caches in the layers, which
# is good, but in our case, we're going to mount a special cache volume (kept between
# builds), so we WANT the cache to persist.
RUN set -eux; \
rm -f /etc/apt/apt.conf.d/docker-clean; \
echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache;
# Install System level build requirements, this is done before
# everything else because these are rarely ever going to change.
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
set -x \
&& apt-get update \
&& apt-get install --no-install-recommends -y \
texlive-latex-base \
texlive-latex-recommended \
texlive-fonts-recommended \
texlive-plain-generic \
lmodern
RUN case $(uname -m) in \
"x86_64") ARCH=amd64 ;; \
"aarch64") ARCH=arm64 ;; \
esac \
&& wget --quiet https://github.com/jgm/pandoc/releases/download/2.17.1.1/pandoc-2.17.1.1-1-${ARCH}.deb \
&& dpkg -i pandoc-2.17.1.1-1-${ARCH}.deb
RUN mkdir /code
WORKDIR /code
COPY dev-requirements.txt /code/
COPY base-requirements.txt /code/
COPY prod-requirements.txt /code/
COPY requirements.txt /code/
RUN pip --no-cache-dir --disable-pip-version-check install --upgrade pip setuptools wheel
RUN --mount=type=cache,target=/root/.cache/pip \
set -x \
&& pip --disable-pip-version-check \
install \
-r requirements.txt -r prod-requirements.txt
COPY . /code/
RUN DJANGO_SETTINGS_MODULE=pydotorg.settings.static python manage.py collectstatic --noinput