-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathDockerfile
More file actions
49 lines (36 loc) · 1.28 KB
/
Dockerfile
File metadata and controls
49 lines (36 loc) · 1.28 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
# Dockerfile for running the felis-cli
FROM python:3.13.7-slim-trixie AS base-image
# Update base packages
COPY scripts/install-base-packages.sh .
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
./install-base-packages.sh && rm ./install-base-packages.sh
FROM base-image AS install-image
# Install dependencies
COPY scripts/install-dependency-packages.sh .
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
./install-dependency-packages.sh
# Install the application
WORKDIR /app
COPY . /app
# Create venv
RUN python -m venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"
# Install build tools
RUN --mount=type=cache,target=/root/.cache/pip \
/opt/venv/bin/pip install --upgrade pip setuptools wheel
# Install application
RUN --mount=type=cache,target=/root/.cache/pip \
/opt/venv/bin/pip install --no-cache-dir . psycopg2-binary
FROM base-image AS runtime-image
RUN useradd --create-home --uid 1001 felis
# Copy installed app
COPY --from=install-image /opt/venv /opt/venv
COPY --from=install-image /app /app
# Set the working directory
WORKDIR /app
# Set PATH to use venv
ENV PATH="/opt/venv/bin:$PATH"
# Run bash by default
CMD ["bash"]