Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: Upgrade Python version to 3.12.3 and optimize Dockerfile. #129

Merged
merged 6 commits into from
Sep 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 14 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,27 +1,30 @@
FROM python:3.9 as base
FROM python:3.12.3-slim AS base

RUN apt-get update && \
apt-get install -y build-essential \
apache2 apache2-dev \
apt-get install -y --no-install-recommends \
build-essential \
apache2 \
apache2-dev \
python3-dev \
default-libmysqlclient-dev \
supervisor \
libsqlcipher-dev \
libsqlite3-dev && \
libsqlite3-dev \
git \
curl && \
rm -rf /var/lib/apt/lists/*

WORKDIR /smswithoutborders-backend
WORKDIR /vault

COPY . .
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf

RUN pip install -U pip && \
pip install -U setuptools wheel && \
pip install --no-cache-dir --force-reinstall -r requirements.txt && \
RUN pip install -U --quiet --no-cache-dir pip setuptools && \
pip install --quiet --no-cache-dir --force-reinstall -r requirements.txt && \
usermod -u 1000 www-data && \
usermod -G root www-data

FROM base as development
FROM base AS development
CMD echo "[*] Starting Development server ..." && \
make dummy-user-inject && \
mod_wsgi-express start-server wsgi_script.py \
Expand All @@ -30,6 +33,6 @@ CMD echo "[*] Starting Development server ..." && \
--port '${PORT}' \
--log-to-terminal

FROM base as production
FROM base AS production
ENV MODE=production
CMD ["/usr/bin/supervisord", "-n", "-c", "/etc/supervisor/conf.d/supervisord.conf"]
CMD ["/usr/bin/supervisord", "-n", "-c", "/etc/supervisor/conf.d/supervisord.conf"]