forked from mmcinnestaylor/Programming-Contest-Suite
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
50 lines (39 loc) · 1.57 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
FROM python:3.10-slim
LABEL maintainer="ACM at FSU <contact@fsu.acm.org>"
ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1
ARG REQUIREMENTS=requirements.txt
RUN apt-get update \
# Dependencies for building Python packages
&& apt-get install -y --no-install-recommends build-essential \
# Translations dependencies
&& apt-get install -y gettext \
# mysqlclient dependency
&& apt-get install -y pkg-config \
# MariaDB dependency
&& apt-get install -y libmariadb-dev \
# cleaning up unused files
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \
&& rm -rf /var/lib/apt/lists/*
# Install requirements and create static file directories
RUN pip install --upgrade pip
COPY $REQUIREMENTS /tmp/requirements.txt
RUN pip install --no-cache-dir -r /tmp/requirements.txt \
&& rm -rf /tmp/requirements.txt \
&& useradd -U app_user \
&& install -d -m 0755 -o app_user -g app_user /app/static \
&& install -d -m 0755 -o app_user -g app_user /app/media \
&& install -d -m 0755 -o app_user -g app_user /app/media/contest_files \
&& install -d -m 0755 -o app_user -g app_user /app/media/ec_files \
&& install -d -m 0755 -o app_user -g app_user /app/media/team_files \
&& install -d -m 0755 -o app_user -g app_user /app/media/uploads
# Code and User Setup
USER app_user:app_user
COPY --chown=app_user:app_user scripts/docker/ docker/
RUN chmod +x docker/*.sh
WORKDIR /app
COPY --chown=app_user:app_user src .
# Docker Run Checks and Configurations
EXPOSE 8000
ENTRYPOINT [ "../docker/entrypoint.sh" ]
CMD [ "../docker/start.sh", "server" ]