-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathDockerfile
More file actions
35 lines (23 loc) · 1.11 KB
/
Dockerfile
File metadata and controls
35 lines (23 loc) · 1.11 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
FROM python:3.10-slim-bookworm AS builder
WORKDIR /app
RUN apt-get update && apt-get install -y --no-install-recommends gcc libpq-dev python3-dev && rm -rf /var/lib/apt/lists/*
COPY requirements.txt .
RUN pip wheel --no-cache-dir --wheel-dir /app/wheels -r requirements.txt
FROM python:3.10-slim-bookworm
RUN apt-get update && apt-get install -y --no-install-recommends libpq5 curl git && \
rm -rf /var/lib/apt/lists/*
RUN ARCH=$(uname -m) && \
if [ "$ARCH" = "x86_64" ]; then PKG_ARCH="x86_64-unknown-linux-gnu"; elif [ "$ARCH" = "aarch64" ]; then PKG_ARCH="aarch64-unknown-linux-gnu"; fi && \
curl -fsSL -L "https://github.com/mohsen1/yek/releases/latest/download/yek-${PKG_ARCH}.tar.gz" \
| tar xz --strip-components=1 -C /usr/local/bin
WORKDIR /app
RUN useradd --create-home appuser
USER appuser
ENV PATH="/home/appuser/.local/bin:${PATH}"
ENV PYTHONPATH=/app
COPY --from=builder /app/wheels /wheels
RUN pip install --no-cache /wheels/*
COPY . .
COPY --chown=appuser:appuser sourceant /home/appuser/.local/bin/sourceant
RUN chmod +x /home/appuser/.local/bin/sourceant
ENTRYPOINT ["/app/start.prod.sh"]