forked from coldfront/coldfront
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathContainerfile.debug
More file actions
84 lines (57 loc) · 2.06 KB
/
Containerfile.debug
File metadata and controls
84 lines (57 loc) · 2.06 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
########################
# 1) Frontend build stage
########################
FROM registry.access.redhat.com/hi/nodejs:latest-builder AS frontend
WORKDIR /app
USER root
# Copy only npm manifests first for caching
COPY coldfront/static/package.json coldfront/static/package-lock.json ./coldfront/static/
WORKDIR /app/coldfront/static
RUN npm ci
# Copy the rest of the frontend sources
COPY coldfront/static ./
# Build (should output bundles + manifest)
RUN npm run build
USER ${CONTAINER_DEFAULT_USER}
########################
# 2) Build Coldfront app
########################
FROM registry.access.redhat.com/hi/python:3.12-builder AS builder
USER root
RUN dnf install -y git && dnf update -y
COPY . /app
# Enable bytecode compilation
ENV UV_COMPILE_BYTECODE=1
# Copy from the cache instead of linking since it's a mounted volume
ENV UV_LINK_MODE=copy
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
WORKDIR /app
RUN mkdir -p /app/.cache/uv
# OpenShift can mount /tmp with noexec; keep uv temp executables on /app.
ENV UV_CACHE_DIR=/app/.cache/uv
RUN uv sync --locked --extra prod
RUN chgrp -R 0 /app/.cache && \
chmod -R g=u /app/.cache
RUN chgrp -R 0 /app/.venv && \
chmod -R g=u /app/.venv
USER ${CONTAINER_DEFAULT_USER}
########################
# 3) Final stage
########################
FROM registry.access.redhat.com/hi/python:3.12-builder
LABEL name="coldfront" \
vendor="NYU RTS" \
description="To gain inteactive access for a deployment of Coldfront in RTC"
# Copy built bundles/manifest from frontend stage into the backend image
COPY --from=frontend /app/coldfront/static/bundles /app/coldfront/static/bundles
# Copy the django app
COPY --from=builder /app /app
# Keep uv's runtime cache off /tmp for OpenShift compatibility.
ENV UV_CACHE_DIR=/app/.cache/uv
# psycopg[binary] links against libstdc++ which the distroless runtime image omits
COPY --from=builder /usr/lib64/libstdc++.so* /usr/lib64/
# Need uv binary in the final image as well
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
# Default port for gunicorn
EXPOSE 8000
WORKDIR /app