-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
49 lines (38 loc) · 1.56 KB
/
Dockerfile
File metadata and controls
49 lines (38 loc) · 1.56 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
FROM python:3.13-slim
EXPOSE 9000
WORKDIR /opt/wsgi
# Install system dependencies including uwsgi and git
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
python3-dev \
git \
tzdata \
&& rm -rf /var/lib/apt/lists/*
# Set timezone
ENV TZ=America/Chicago
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
# Create system group and user
ENV SERVICE_NAME="uwsgi"
RUN addgroup --gid 1001 --system $SERVICE_NAME && \
adduser --uid 1001 --gid 1001 --system --disabled-login --shell /bin/false $SERVICE_NAME && \
mkdir -p /var/log/$SERVICE_NAME && \
mkdir -p /opt/venv && \
chown $SERVICE_NAME:$SERVICE_NAME /var/log/$SERVICE_NAME /opt/venv /opt/wsgi
USER $SERVICE_NAME
# Create virtual environment
ENV VENV_PATH="/opt/venv"
RUN python3 -m venv $VENV_PATH
ENV PATH="$VENV_PATH/bin:$PATH"
# Upgrade pip inside venv
RUN pip install --upgrade pip setuptools wheel uwsgi
# Copy pyproject.toml early for caching
COPY --chown=$SERVICE_NAME:$SERVICE_NAME ./BackEnd/bmrbdep/pyproject.toml /opt/wsgi/
# Install Python dependencies inside venv
RUN pip install --no-cache-dir .
# Copy static files
COPY --chown=$SERVICE_NAME:$SERVICE_NAME ./wsgi.conf /opt/wsgi/wsgi.conf
COPY --chown=$SERVICE_NAME:$SERVICE_NAME ./BackEnd/schema/schema_data/ /opt/wsgi/schema_data/
COPY --chown=$SERVICE_NAME:$SERVICE_NAME ./FrontEnd/dist/ /opt/wsgi/dist/
# Copy backend code last for caching efficiency
COPY --chown=$SERVICE_NAME:$SERVICE_NAME ./BackEnd/bmrbdep/ /opt/wsgi/bmrbdep/
CMD ["uwsgi", "--ini", "/opt/wsgi/wsgi.conf"]