-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathDockerfile.dev
More file actions
58 lines (47 loc) · 1.98 KB
/
Copy pathDockerfile.dev
File metadata and controls
58 lines (47 loc) · 1.98 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
# Dockerfile.dev - Fast local build using binary wheels (no Rust/C compiles).
# Use for local development only. Production/Konflux should use the main Dockerfile.
FROM registry.access.redhat.com/ubi9/python-312:latest
WORKDIR /app
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PIP_NO_CACHE_DIR=1 \
PIP_DISABLE_PIP_VERSION_CHECK=1 \
VIRTUAL_ENV="/app/.venv" \
PATH="/app/.venv/bin:$PATH"
# Minimal runtime deps only (psycopg needs libpq at runtime). No gcc/rust/-devel.
USER root
RUN dnf install -y postgresql-libs && \
dnf clean all && \
rm -rf /var/cache/dnf && \
mkdir -p /app && \
chown -R 1001:1001 /app
COPY --chown=1001:1001 . /app/
# Red Hat Certification Requirement: Copy licenses directory to container root
# This satisfies the HasLicense preflight check
COPY --chown=root:root licenses /licenses
USER 1001
# Install uv and use it to install dependencies (faster than pip, uses binary wheels)
# Explicitly use python3.12 since the default python3 is 3.9
# Create virtual environment and install packages there
RUN pip install --no-cache-dir uv && \
uv venv --python python3.12 /app/.venv && \
uv pip install --python /app/.venv/bin/python --no-cache .
USER root
COPY --chown=1001:1001 scripts/docker-entrypoint.sh /usr/local/bin/
COPY --chown=1001:1001 scripts/init.sh /usr/local/bin/
RUN chmod 555 /usr/local/bin/docker-entrypoint.sh && \
chmod 555 /usr/local/bin/init.sh && \
rm -rf /app/logs /app/staticfiles && \
mkdir -p /app/logs /app/staticfiles && \
chown -R 1001:1001 /app && \
chmod -R a-w /app && \
chmod 555 /app && \
chmod 755 /app/logs /app/staticfiles && \
chmod -R u+w /app/.venv
USER 1001
RUN /app/.venv/bin/python manage.py collectstatic --noinput --clear
EXPOSE 8000
ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["/app/.venv/bin/python", "manage.py", "metrics_service", "run", "--host", "0.0.0.0", "--port", "8000"]
LABEL name="metrics-service-dev" \
summary="Metrics Service (dev build, binary wheels only)"