Use slim container variant

This reduces the size of the container, which makes working with it much easier
This commit is contained in:
Jake Howard 2022-08-27 18:22:58 +01:00
parent 54a7dd2660
commit c6776faa8c
Signed by: jake
GPG key ID: 57AFB45680EDD477
2 changed files with 17 additions and 6 deletions

View file

@ -1,7 +1,7 @@
FROM node:16-slim as frontend
COPY package.json package-lock.json ./
RUN npm ci --no-audit --progress=false --omit=dev
RUN npm ci --no-audit - -progress=false --omit=dev
# Compile static files
COPY ./scripts ./scripts
@ -9,7 +9,7 @@ COPY ./static/src ./static/src
RUN npm run build
# The actual container
FROM python:3.10 as production
FROM python:3.10-slim as production
ENV VIRTUAL_ENV=/venv
@ -17,7 +17,12 @@ RUN useradd website --create-home -u 1000 && mkdir /app $VIRTUAL_ENV && chown -R
WORKDIR /app
RUN wget https://github.com/aptible/supercronic/releases/download/v0.2.1/supercronic-linux-amd64 -O /usr/local/bin/supercronic && chmod +x /usr/local/bin/supercronic
RUN apt-get update --yes --quiet && apt-get install --yes --quiet --no-install-recommends \
build-essential \
libpq-dev \
curl
RUN curl -fsSL https://github.com/aptible/supercronic/releases/download/v0.2.1/supercronic-linux-amd64 -o /usr/local/bin/supercronic && chmod +x /usr/local/bin/supercronic
ENV PATH=$VIRTUAL_ENV/bin:$PATH \
PYTHONUNBUFFERED=1
@ -30,6 +35,8 @@ RUN python -m venv $VIRTUAL_ENV
COPY --chown=website requirements/base.txt ./requirements/base.txt
RUN pip install --no-cache --upgrade pip && pip install --no-cache -r ./requirements/base.txt
RUN apt-get remove --yes build-essential && apt-get autoremove --yes && rm -rf /var/lib/apt/lists /var/cache/apt
COPY --chown=website --from=frontend ./static/build ./static/build
COPY --chown=website ./etc ./etc