-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
54 lines (41 loc) · 1.63 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
47
48
49
50
51
52
53
54
FROM nikolaik/python-nodejs:python3.10-nodejs18-slim
# Set environment variables.
# 1. Force Python stdout and stderr streams to be unbuffered.
# 2. Set PORT variable that is used by Gunicorn. This should match "EXPOSE"
# command.
ENV PYTHONUNBUFFERED=1 \
PORT=8000
# Install system packages required by Wagtail and Django.
RUN --mount=type=cache,target=var/cache/apt/archives apt-get update --yes --quiet && apt-get install --yes --quiet --no-install-recommends \
build-essential \
libpq-dev \
# libmariadbclient-dev \
libjpeg62-turbo-dev \
zlib1g-dev \
libwebp-dev\
git
# Install the application server.
RUN pip install "gunicorn[gevent]>=20.1.0,<20.2"
RUN --mount=type=cache,target=/root/.npm pip install \
"git+https://github.com/engAmirEng/wagtail.git@02788dd5ca6dd4eea5a"
# Use /app folder as a directory where the source code is stored.
WORKDIR /project
# Install the project requirements.
COPY requirements.txt .
# Cache potential requirements
RUN --mount=type=cache,target=/root/.cache/pip pip install -r requirements.txt
# Install the JS requirements.
COPY package.json package-lock.json .
RUN --mount=type=cache,target=/root/.npm npm ci
# Add user that will be used in the container.
RUN useradd app
# Set this directory to be owned by the "app" user.
RUN chown app:app /project
# Copy the source code of the project into the container.
COPY --chown=app:app . .
# Build Vite
RUN npm run build
# Use user "app" to run the build commands below and the server itself.
# USER app
EXPOSE 8000
CMD python manage.py collectstatic --noinput && gunicorn --config config/gunicorn.config.py config.wsgi:application