forked from mher/flower
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
43 lines (31 loc) · 1.25 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
FROM --platform=linux/amd64 python:alpine AS builder
RUN mkdir -p /build
WORKDIR /build
ADD . .
RUN python setup.py sdist
FROM --platform=linux/amd64 python:alpine
# Get latest root certificates
RUN apk add --no-cache ca-certificates tzdata && update-ca-certificates
# Install the required packages
RUN pip install --no-cache-dir redis
RUN --mount=type=bind,from=builder,source=/build/dist,target=/package pip install /package/*
# PYTHONUNBUFFERED: Force stdin, stdout and stderr to be totally unbuffered. (equivalent to `python -u`)
# PYTHONHASHSEED: Enable hash randomization (equivalent to `python -R`)
# PYTHONDONTWRITEBYTECODE: Do not write byte files to disk, since we maintain it as readonly. (equivalent to `python -B`)
ENV PYTHONUNBUFFERED=1 PYTHONHASHSEED=random PYTHONDONTWRITEBYTECODE=1
# Default port
EXPOSE 5555
ENV FLOWER_DATA_DIR /data
ENV PYTHONPATH ${FLOWER_DATA_DIR}
WORKDIR $FLOWER_DATA_DIR
ADD entrypoint.sh /
RUN chmod +x /entrypoint.sh
# Add a user with an explicit UID/GID and create necessary directories
RUN set -eux; \
addgroup -g 1000 flower; \
adduser -u 1000 -G flower flower -D; \
mkdir -p "$FLOWER_DATA_DIR"; \
chown flower:flower "$FLOWER_DATA_DIR"
USER flower
VOLUME $FLOWER_DATA_DIR
ENTRYPOINT ["/entrypoint.sh"]