-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
46 lines (36 loc) · 1.35 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
45
46
# Use an official Python runtime based on Debian 10 "buster" as a parent image.
FROM python:3.9-slim-bullseye
# Set environment variables.
# 1. Force Python stdout and stderr streams to be unbuffered.
ENV PYTHONUNBUFFERED=1
# Install system packages required by Wagtail and Django.
RUN apt-get update --yes --quiet && apt-get install --yes --quiet --no-install-recommends \
build-essential \
libpq-dev \
libjpeg62-turbo-dev \
zlib1g-dev \
libwebp-dev \
curl \
gettext \
&& rm -rf /var/lib/apt/lists/*
# Nodejs plus npm is required for webpack (to generate bundles)
RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash -
RUN apt-get update && apt-get install -y nodejs
# Add group:user that will be used in the container.
RUN groupadd --gid 2000 wagtail
RUN useradd --uid 2000 --gid wagtail --create-home wagtail
# Use /src folder as a directory where the source code is stored.
WORKDIR /src
# Set this directory to be owned by the "wagtail" user.
RUN chown wagtail:wagtail /src
# Python dependencies
COPY requirements.txt /src/
RUN pip install -r /src/requirements.txt
# JS dependencies
COPY package.json /src/
COPY package-lock.json /src/
RUN npm install
# Copy the source code of the project into the container.
COPY --chown=wagtail:wagtail . /src
# Use user "wagtail" to run the build commands and the server itself.
USER wagtail