-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
74 lines (46 loc) · 2.07 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# Base
FROM fedora:40 AS base
ENV INGINIOUS_DIR=/var/www/INGInious
ENV INGINIOUS_WEBAPP_HOST=0.0.0.0
ENV INGINIOUS_WEBAPP_PORT=80
ENV INGINIOUS_WEBDAV_HOST=0.0.0.0
ENV INGINIOUS_WEBDAV_PORT=8080
ENV INGINIOUS_WEBAPP_CONFIG=${INGINIOUS_DIR}/configuration.yaml
ENV PYTHONUNBUFFERED=1
VOLUME [ "${INGINIOUS_DIR}" ]
WORKDIR ${INGINIOUS_DIR}
RUN dnf install -y git gcc libtidy python3 python3-devel python3-pip python3-setuptools zeromq-devel dnf-plugins-core xmlsec1-openssl-devel libtool-ltdl-devel which && \
dnf config-manager --add-repo https://download.docker.com/linux/fedora/docker-ce.repo && \
dnf install -y docker-ce-cli && \
dnf clean all && \
mkdir tasks && \
mkdir backup
# Development
FROM base AS development
ENV PYTHONDONTWRITEBYTECODE=1
ENV POETRY_HOME=/opt/poetry
RUN python3 -m venv $POETRY_HOME && \
$POETRY_HOME/bin/pip install poetry~=1.8 && \
ln -s $POETRY_HOME/bin/poetry /usr/local/bin/poetry
# Builder
FROM development AS builder
WORKDIR /app
COPY pyproject.toml poetry.lock ./
COPY . .
RUN poetry export --without-hashes -f requirements.txt | pip install --prefix /env/ -r /dev/stdin
# Production
FROM base AS production
RUN dnf install -y lighttpd lighttpd-fastcgi && \
usermod -aG docker lighttpd && \
chown -R lighttpd:lighttpd .
COPY --from=builder /env/ /usr/local/
RUN sed -i 's|server.document-root = server_root + "/lighttpd"|server.document-root = server_root + "/INGInious"|' /etc/lighttpd/lighttpd.conf && \
sed -i 's|server.pid-file = state_dir + "/lighttpd.pid"|#server.pid-file = state_dir + "/lighttpd.pid"|' /etc/lighttpd/lighttpd.conf && \
sed -i 's|server.port = 80|server.port = 8080|' /etc/lighttpd/lighttpd.conf && \
echo 'include "/etc/lighttpd/vhosts.d/inginious.conf"' >> /etc/lighttpd/lighttpd.conf && \
chown -R lighttpd:lighttpd /usr/local/lib/python3.12/site-packages/inginious/frontend/static/
USER lighttpd
COPY modules.conf /etc/lighttpd/modules.conf
COPY inginious.conf /etc/lighttpd/vhosts.d/inginious.conf
EXPOSE ${INGINIOUS_WEBAPP_PORT}
CMD lighttpd -D -f /etc/lighttpd/lighttpd.conf