-
Notifications
You must be signed in to change notification settings - Fork 528
/
Dockerfile
58 lines (46 loc) · 1.82 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
55
56
57
58
FROM python:3.11-bookworm AS server
ARG USER_ID=1000
ARG GROUP_ID=1000
ENV DEBIAN_FRONTEND=noninteractive
ENV HGPYTHON3=1
# Python environment variables
ENV PYTHONUNBUFFERED 1
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONPATH /app
# Install required software.
RUN apt-get update \
# Enable downloading packages over https
&& apt-get install -y apt-transport-https \
# Add source for node.js
&& curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \
&& echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_18.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list \
# Install software
&& apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
libmemcached-dev \
nodejs \
postgresql-client \
postgresql-server-dev-15 \
# Clean up what can be cleaned up.
&& apt-get autoremove -y
# Install uv
COPY --from=ghcr.io/astral-sh/uv:0.4.13 /uv /bin/uv
WORKDIR /app
# Install Pontoon Python requirements
COPY requirements/* /app/requirements/
RUN uv pip install --system -r requirements/default.txt -r requirements/dev.txt -r requirements/test.txt -r requirements/lint.txt
# Create the app user
RUN groupadd -r --gid=${GROUP_ID} pontoon && useradd --uid=${USER_ID} --no-log-init -r -m -g pontoon pontoon
RUN chown -R pontoon:pontoon /app
USER pontoon
# Install the server's Node.js requirements
ENV YUGLIFY_BINARY /app/node_modules/.bin/yuglify
ENV TERSER_BINARY /app/node_modules/.bin/terser
COPY --chown=pontoon:pontoon pontoon/package.json .
RUN npm install
COPY --chown=pontoon:pontoon ./docker/config/server.env .env
COPY --chown=pontoon:pontoon . /app/
RUN python manage.py collectstatic
STOPSIGNAL SIGINT
CMD ["/app/docker/server_run.sh"]