-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
56 lines (42 loc) · 1.11 KB
/
Dockerfile
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
#
# Builder image
#
FROM python:3.13.2-slim as builder
RUN apt-get update && \
apt-get install -y --no-install-recommends gcc python3-dev
# Directories paths as environment variables
ENV APP_HOME=/app
ENV VIRTUAL_ENV=/app/venv
# Working directory
WORKDIR $APP_HOME
RUN mkdir $VIRTUAL_ENV
# Copy requirements.txt
COPY requirements.txt $APP_HOME
# Active Python venv
RUN python -m venv $VIRTUAL_ENV
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
# Install requirements.txt
RUN pip install --upgrade pip && \
pip install --no-cache-dir -r requirements.txt
#
# Production size image
#
FROM python:3.13.2-slim as production
# Directories paths as environment variables
ENV APP_HOME=/app
ENV VIRTUAL_ENV=/app/venv
# Set PATH to include venv
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
# Working directory
WORKDIR $APP_HOME
RUN mkdir $VIRTUAL_ENV
# Use a non-root user
RUN useradd -m cli && \
chown cli:cli $VIRTUAL_ENV
USER cli
# Copy sources from builder image
COPY --from=builder --chown=cli:cli $VIRTUAL_ENV $VIRTUAL_ENV
# Active Python venv
RUN python -m venv $VIRTUAL_ENV
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
ENTRYPOINT ["app-store-connect"]