-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
45 lines (39 loc) · 1.56 KB
/
Dockerfile
File metadata and controls
45 lines (39 loc) · 1.56 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
FROM alpine:3.22
LABEL org.opencontainers.image.source=https://github.com/offspot/adminui
RUN apk add --no-cache curl dumb-init yaml python3
COPY pyproject.toml README.md /src/
WORKDIR /src
RUN python3 -m venv .venv \
&& .venv/bin/pip install -U pip \
# fake stub module to install deps via pip
&& mkdir -p src/adminui \
&& touch src/adminui/__init__.py \
&& .venv/bin/pip install -e .
ENV STATIC_DIR=/var/www/static
RUN \
# FontAwesome font
mkdir -p ${STATIC_DIR} \
&& curl -L -O https://use.fontawesome.com/releases/v7.1.0/fontawesome-free-7.1.0-web.zip \
&& unzip -o fontawesome-free-7.1.0-web.zip -d ${STATIC_DIR}/ \
&& rm -f fontawesome-free-7.1.0-web.zip \
&& curl -L -O https://github.com/twbs/bootstrap/releases/download/v5.3.8/bootstrap-5.3.8-dist.zip \
&& unzip -o bootstrap-5.3.8-dist.zip -d ${STATIC_DIR}/ \
&& rm -f bootstrap-5.3.8-dist.zip \
&& apk del curl \
# WARN: this break apk but saves a lot of space
# it's OK on prod but comment it during dev if you need packages
&& apk del apk-tools ca-certificates-bundle
ENV ADMIN_USERNAME=
ENV ADMIN_PASSWORD=
ENV SESSION_COOKIE_NAME=
ENV DEFAULT_SESSION_DURATION_MN=
COPY README.md main.py LICENSE /src/
COPY src /src/src/
RUN \
ls -lh /src/src/adminui/static/ \
&& mv /src/src/adminui/static/*.js /src/src/adminui/static/branding ${STATIC_DIR}/ \
&& .venv/bin/pip install -e . \
&& rm -rf /root/.cache/pip
EXPOSE 80
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
CMD ["/src/.venv/bin/fastapi", "run", "--host", "0.0.0.0", "--port", "80"]