-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
64 lines (49 loc) · 1.9 KB
/
Copy pathDockerfile
File metadata and controls
64 lines (49 loc) · 1.9 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
# ---------- base ----------
# Shared foundation: Python deps, app code, and scripts.
# Both `backend` (the FastAPI service) and `cli` extend this
# so we install requirements.txt exactly once.
FROM uselagoon/python-3.12:latest@sha256:5ab457220705f7b4c072ee746b5920779a385a70175e0471b9a263c840ff1070 AS base
RUN apk add --no-cache bash curl
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY app app/
COPY scripts scripts/
ENV PYTHONPATH=/app
# ---------- cli ----------
# CLI / migration / DB-restore pod. Adds postgres client tooling
# (matched to pgvector/pgvector:pg16 server) and the usual CLI niceties.
# Built explicitly via `--target cli` (or compose `target: cli`).
FROM base AS cli
ENV LAGOON=cli
RUN apk add --no-cache \
coreutils \
findutils \
git \
gzip \
openssh-client \
openssh-sftp-server \
postgresql16-client \
procps \
unzip \
&& ln -s /usr/lib/ssh/sftp-server /usr/local/bin/sftp-server \
&& mkdir -p /home/.ssh \
&& fix-permissions /home/
# Idle shells get killed (matches php-cli/node-cli convention).
# Guarded because python-3.12 base does not always ship 80-shell-timeout.sh.
RUN echo "[ -f /lagoon/entrypoints/80-shell-timeout.sh ] && source /lagoon/entrypoints/80-shell-timeout.sh" >> /home/.bashrc
CMD ["/bin/docker-sleep"]
# ---------- backend ----------
# FastAPI service. Kept as the LAST stage so a bare `docker build .`
# (no --target) builds the backend image, preserving pre-refactor
# behaviour for CI scripts, IDE integrations, and ad-hoc dev builds.
FROM base AS backend
# Copy Lagoon environment variables
COPY .lagoon.env .
# Script to initialize the database and start the server
RUN mkdir -p /app/logs && \
chown -R 1000:1000 /app/logs && \
chmod 775 /app/logs
COPY backend-start.sh .
RUN chmod +x /app/backend-start.sh
CMD ["/app/backend-start.sh"]