-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
53 lines (39 loc) · 1.65 KB
/
Dockerfile
File metadata and controls
53 lines (39 loc) · 1.65 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
FROM python:3.12-slim
# Accept build arguments for git information
ARG GIT_BRANCH=unknown
ARG GIT_COMMIT=unknown
ARG DEPLOYMENT_ENVIRONMENT=production
# Set environment variables from build args
ENV GIT_BRANCH=${GIT_BRANCH}
ENV GIT_COMMIT=${GIT_COMMIT}
ENV DEPLOYMENT_ENVIRONMENT=${DEPLOYMENT_ENVIRONMENT}
# Note: ROLLBAR_ACCESS_TOKEN is injected at runtime by the CodeDeploy
# before_install.sh script, which reads it from deployment-info.json
# (populated by CI from the GitHub repo secret). This avoids exposing
# secrets in the Docker image layers.
# Install build tools and dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends build-essential gcc curl \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Install poetry first (also upgrade pip to address CVE-2026-1703)
RUN pip install --no-cache-dir --upgrade pip poetry
# Configure Poetry: Disable virtualenv (install in system site-packages)
RUN poetry config virtualenvs.create false
# Copy dependency files for better layer caching
COPY pyproject.toml ./
COPY poetry.lock ./
# Install dependencies only (without installing the project)
RUN poetry install --no-interaction --no-ansi --no-root
# Copy the rest of the project files
COPY README.md ./
COPY trendsearth_ui ./trendsearth_ui
COPY gunicorn.conf.py ./
# Now install the project itself
RUN poetry install --no-interaction --no-ansi
# Compile translations (generates .mo files from .po files)
RUN pybabel compile -d trendsearth_ui/i18n/translations --use-fuzzy
# Expose port 8000 (gunicorn default)
EXPOSE 8000
# Run the app with gunicorn using config file
CMD ["gunicorn", "--config", "gunicorn.conf.py", "trendsearth_ui.app:server"]