This repository was archived by the owner on Oct 28, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathDockerfile
More file actions
63 lines (51 loc) · 1.38 KB
/
Copy pathDockerfile
File metadata and controls
63 lines (51 loc) · 1.38 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# ------------------------
# Python base stage:
# ------------------------
FROM python:3.9.13-alpine3.16 as base
ENV PYTHONFAULTHANDLER=1 \
PYTHONUNBUFFERED=1 \
PYSETUP_PATH=/opt/pysetup \
POETRY_HOME=/opt/poetry \
POETRY_VIRTUALENVS_IN_PROJECT=true
ENV PATH="$POETRY_HOME/bin:$VENV_PATH/bin:$PATH"
# ------------------------
# Environment build stage:
# ------------------------
FROM base as build
ENV PIP_DEFAULT_TIMEOUT=100 \
PIP_DISABLE_PIP_VERSION_CHECK=1 \
PIP_NO_CACHE_DIR=1 \
POETRY_VERSION=1.1.13
WORKDIR $PYSETUP_PATH
COPY poetry.lock pyproject.toml ./
RUN set -x && \
apk add --no-cache --virtual .build-deps \
postgresql-dev \
build-base \
gcc \
curl \
python3-dev \
libffi-dev \
libressl-dev \
musl-dev \
lld \
rust \
cargo && \
curl -sSL https://install.python-poetry.org | python3 - && \
poetry install --no-dev && \
apk del --no-cache .build-deps
# ------------------------
# Runtime stage:
# ------------------------
FROM base as runtime
RUN set -x && \
apk add --no-cache rust libpq
RUN addgroup -S apigroup && \
adduser -S apiuser -G apigroup
USER apiuser
WORKDIR $PYSETUP_PATH
COPY --from=build $POETRY_HOME $POETRY_HOME
COPY --from=build $PYSETUP_PATH $PYSETUP_PATH
COPY ./keystone_scim /$PYSETUP_PATH/keystone_scim
EXPOSE 5001
CMD ["poetry", "run", "keystone-scim"]