Skip to content
Snippets Groups Projects
Commit 76b08f9f authored by Roang's avatar Roang
Browse files

Add Dockerfile cache configuration

* Add args for set up the chache directories
* Add apt cache configuration and mounts
parent 8554efdf
Branches
No related tags found
No related merge requests found
FROM python:3.11-bookworm as base FROM python:3.11-bookworm as base
ARG DEVELOPMENT=False ARG DEVELOPMENT=False
ENV DEBIAN_FRONTEND=noninteractive ENV DEBIAN_FRONTEND=noninteractive
ENV PDM_CHECK_UPDATE=false
RUN echo 'APT::Install-Recommends "false";' > /etc/apt/apt.conf.d/99-unattended-minimal && \
echo 'APT::Install-Suggests "false";' >> /etc/apt/apt.conf.d/99-unattended-minimal && \
echo 'APT::Get::Assume-Yes "true";' >> /etc/apt/apt.conf.d/99-unattended-minimal
######################################### [build] ############################# ######################################### [build] #############################
...@@ -9,15 +15,15 @@ FROM base as build ...@@ -9,15 +15,15 @@ FROM base as build
ENV LC_ALL=C.UTF-8 ENV LC_ALL=C.UTF-8
RUN apt-get update && \ RUN --mount=target=/var/lib/apt/lists/,type=cache,sharing=locked \
apt-get install -y --no-install-recommends \ --mount=target=/var/cache/apt/archives/,type=cache,sharing=locked \
apt-get update && \
apt-get install \
build-essential \ build-essential \
gdal-bin libproj-dev \ gdal-bin libproj-dev \
gettext \ gettext \
locales \ locales \
yarnpkg && \ yarnpkg && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* && \
dpkg-reconfigure locales && \ dpkg-reconfigure locales && \
locale-gen C.UTF-8 && \ locale-gen C.UTF-8 && \
/usr/sbin/update-locale LANG=C.UTF-8 && \ /usr/sbin/update-locale LANG=C.UTF-8 && \
...@@ -85,17 +91,17 @@ ENV LC_ALL=C.UTF-8 ...@@ -85,17 +91,17 @@ ENV LC_ALL=C.UTF-8
ENV DJANGO_SETTINGS_MODULE=hub.settings.default ENV DJANGO_SETTINGS_MODULE=hub.settings.default
ENV DOCKER_UID=1000 ENV DOCKER_UID=1000
RUN apt-get update && \ RUN --mount=target=/var/lib/apt/lists/,type=cache,sharing=locked \
apt-get install -y --no-install-recommends \ --mount=target=/var/cache/apt/archives/,type=cache,sharing=locked \
apt-get update && \
apt-get install \
gdal-bin libproj-dev \ gdal-bin libproj-dev \
rsync && \ rsync && \
if [ "$DEVELOPMENT" = "True" ]; then\ if [ "$DEVELOPMENT" = "True" ]; then\
apt-get install -y --no-install-recommends \ apt-get install \
gettext \ gettext \
yarnpkg; \ yarnpkg; \
fi && \ fi && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* && \
useradd -u $DOCKER_UID -ms /bin/bash -d /app_home appuser useradd -u $DOCKER_UID -ms /bin/bash -d /app_home appuser
COPY deployment/docker/app.sh /usr/local/bin/app COPY deployment/docker/app.sh /usr/local/bin/app
...@@ -142,11 +148,3 @@ WORKDIR /app ...@@ -142,11 +148,3 @@ WORKDIR /app
RUN export DJANGO_SETTINGS_MODULE='hub.settings.build' && \ RUN export DJANGO_SETTINGS_MODULE='hub.settings.build' && \
app build && \ app build && \
unset DJANGO_SETTINGS_MODULE unset DJANGO_SETTINGS_MODULE
######################################### [webworker] #########################
# default docker build target
FROM webworker
ENV BIND_HTTP=1
EXPOSE 8000
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment