-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile
More file actions
39 lines (30 loc) · 927 Bytes
/
Dockerfile
File metadata and controls
39 lines (30 loc) · 927 Bytes
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
ARG IMAGE_TAG="3.13"
# Builder stage
FROM python:${IMAGE_TAG}-alpine AS builder
ARG IMAGE_TAG
WORKDIR /app
# Install UV
RUN apk add --no-cache curl && curl -LsSf https://astral.sh/uv/install.sh | sh
ENV PATH="/root/.local/bin:$PATH"
# Install dependencies
COPY pyproject.toml .
RUN uv sync
RUN uv pip compile pyproject.toml -o requirements.txt
RUN uv pip install --system -r requirements.txt
# Runtime stage
FROM python:${IMAGE_TAG}-alpine
ARG IMAGE_TAG
WORKDIR /app
# Copy dependencies from builder stage
COPY --from=builder /usr/local/lib/python${IMAGE_TAG}/site-packages /usr/local/lib/python${IMAGE_TAG}/site-packages
COPY --from=builder /usr/local/bin /usr/local/bin
# Copy application files
COPY src ./src
COPY resource ./resource
COPY pyproject.toml .
COPY install.py .
COPY main.py .
EXPOSE ${PORT:-80}
# run entrypoint
RUN chmod +x resource/docker-entrypoint.sh
ENTRYPOINT [ "resource/docker-entrypoint.sh" ]