-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
44 lines (30 loc) · 1.23 KB
/
Dockerfile
File metadata and controls
44 lines (30 loc) · 1.23 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
ARG PY_VERSION=3.13
FROM python:${PY_VERSION}-slim-bullseye AS builder
ENV PATH=/root/.local/bin:$PATH
WORKDIR /tmp
COPY requirements.txt /tmp/
RUN pip install --user --no-cache-dir -r requirements.txt
COPY dist /tmp/dist/
RUN pip install --user --no-cache-dir --find-links /tmp/dist platform-disk-api \
&& rm -rf /tmp/dist
FROM python:${PY_VERSION}-slim-bullseye AS runtime
LABEL org.opencontainers.image.source="https://github.com/neuro-inc/platform-disk-api"
WORKDIR /app
# Name of your service (folder under /home)
ARG SERVICE_NAME="platform-disk-api"
ARG SERVICE_UID=1001
ARG SERVICE_GID=1001
RUN addgroup --gid $SERVICE_GID $SERVICE_NAME && \
adduser --uid $SERVICE_UID --gid $SERVICE_GID \
--home /home/$SERVICE_NAME --shell /bin/false \
--disabled-password --gecos "" $SERVICE_NAME
# Tell Python where the "user" site is
ENV HOME=/home/${SERVICE_NAME}
ENV PYTHONUSERBASE=/home/${SERVICE_NAME}/.local
ENV PATH=/home/${SERVICE_NAME}/.local/bin:$PATH
# Copy everything from the builder’s user‐site into your service’s user‐site
COPY --from=builder --chown=$SERVICE_NAME:$SERVICE_GID /root/.local /home/${SERVICE_NAME}/.local
WORKDIR /app
ENV NP_DISK_API_PORT=8080
EXPOSE $NP_DISK_API_PORT
CMD ["platform-disk-api"]