forked from GISA-OSS/lufa
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
62 lines (47 loc) · 1.89 KB
/
Copy pathDockerfile
File metadata and controls
62 lines (47 loc) · 1.89 KB
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
# =============================================================================
# Build Arguments (global)
# =============================================================================
ARG NPM_REGISTRY=https://registry.npmjs.org
ARG STRICT_SSL=true
ARG BASE_IMAGE=docker.io/ubuntu:noble
# =============================================================================
# Stage 1: BUILD — npm install + bundle vendor frontend assets
# =============================================================================
FROM docker.io/node:20-slim AS frontend
ARG NPM_REGISTRY
ARG STRICT_SSL
WORKDIR /build
RUN mkdir -p dist
COPY package*.json ./
COPY scripts/ ./scripts
RUN npm config set registry ${NPM_REGISTRY} \
&& npm config set strict-ssl ${STRICT_SSL} \
&& npm install && bash scripts/copy-assets.sh
# =============================================================================
# Stage 2: RUN — Python application served by uWSGI
# =============================================================================
FROM ${BASE_IMAGE}
# Install system dependencies
RUN apt-get update \
&& apt-get --no-install-recommends install -y \
dumb-init gcc python3-dev python3-pip python3-venv \
uwsgi-core uwsgi-plugin-python3 \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /lufa
# User context
RUN useradd -ms /bin/bash lufa \
&& chown root:lufa .
# Install Python dependencies
COPY --chown=root:lufa --chmod=755 requirements.txt ./
RUN python3 -m venv /opt/venv \
&& /opt/venv/bin/pip install --no-cache-dir -r requirements.txt
# Copy application files
COPY --chown=root:lufa --chmod=755 lufa ./lufa
COPY --chown=root:lufa --chmod=755 lufa.ini wsgi.py pyproject.toml ./
COPY --from=frontend --chown=root:lufa --chmod=755 /build/lufa/static/dist ./lufa/static/dist
USER lufa
# run
EXPOSE 8080/tcp
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
CMD ["/opt/venv/bin/uwsgi", "lufa.ini"]