forked from muayyad-alsadi/pyredis-dump
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
36 lines (24 loc) · 832 Bytes
/
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
ARG PYTHON_VERSION=alpine
FROM python:$PYTHON_VERSION AS base
ENV APP_ROOT=/app
WORKDIR $APP_ROOT
RUN python -m venv $APP_ROOT/venv
ENV PATH="$APP_ROOT/venv/bin:$PATH"
COPY requirements.txt .
RUN python -m pip install --upgrade pip && \
python -m pip install -r requirements.txt
FROM base AS compile
ENV USER_ID=65535
ENV GROUP_ID=65535
ENV USER_NAME=python
ENV GROUP_NAME=python
RUN addgroup -g $USER_ID $GROUP_NAME && \
adduser --shell /bin/nologin --disabled-password \
--no-create-home --uid $USER_ID --ingroup $GROUP_NAME $USER_NAME && \
chown $USER_NAME:$GROUP_NAME $APP_ROOT
WORKDIR $APP_ROOT
COPY --chown=$USER_NAME:$GROUP_NAME --from=base $APP_ROOT/venv ./venv
COPY --chown=$USER_NAME:$GROUP_NAME . .
USER $USER_NAME
ENV PATH="$APP_ROOT/venv/bin:$PATH"
ENTRYPOINT ["python", "pyredis-dump.py"]