-
-
Notifications
You must be signed in to change notification settings - Fork 35
/
Copy pathDockerfile
61 lines (47 loc) · 1.44 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
FROM python:3.12-slim-bookworm
ARG BUILD_DEPS=" \
curl \
git \
gcc g++ make \
"
RUN apt-get update && \
apt-get install \
--no-install-suggests \
--no-install-recommends \
-y \
$BUILD_DEPS
# Install nvm
SHELL ["/bin/bash", "--login", "-c"]
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
# Install nodejs & npm
RUN nvm install --lts && npm install -g npm@latest
WORKDIR /code/website
# Python dependencies
RUN pip install --upgrade pip \
&& pip install uWSGI==2.0.23 poetry==2.0.1
COPY poetry.lock pyproject.toml /code/website/
RUN poetry config virtualenvs.create false \
&& poetry install --no-interaction --no-ansi --no-root --with dev
# Node dependencies
COPY ./package.json /code/website/
RUN npm install
COPY website /code/website/website/
COPY run.py plugins-generate.py pytest.ini /code/website/
# Static files
RUN npm run build
# Plugins
RUN mkdir /code/plugins && chown www-data:www-data /code/plugins
USER www-data:www-data
RUN ./plugins-generate.py
USER root
RUN python -m pytest
COPY ./docker/uwsgi.ini /etc/uwsgi/uwsgi.ini
# Cleanup build dependencies
RUN poetry remove --no-interaction --no-ansi --group dev \
flask-testing pytest pytest-cov
RUN rm -rf ./node_modules .pytest_cache .coverage \
&& apt-get purge -y $BUILD_DEPS \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/*
EXPOSE 3031
CMD ["uwsgi", "/etc/uwsgi/uwsgi.ini"]