Skip to content

Commit

Permalink
Merge pull request #434 from DDS-Derek/tini
Browse files Browse the repository at this point in the history
feat: from s6-overlay change to tini and su-exec
  • Loading branch information
EstrellaXD authored Aug 28, 2023
2 parents 0c860c5 + bc89922 commit 152aa20
Show file tree
Hide file tree
Showing 17 changed files with 24 additions and 60 deletions.
28 changes: 9 additions & 19 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
# syntax=docker/dockerfile:1

FROM alpine:3.18 AS APP
FROM alpine:3.18

ENV S6_SERVICES_GRACETIME=30000 \
S6_KILL_GRACETIME=60000 \
S6_CMD_WAIT_FOR_SERVICES_MAXTIME=0 \
S6_SYNC_DISKS=1 \
TERM="xterm" \
HOME="/ab" \
LANG="C.UTF-8" \
ENV LANG="C.UTF-8" \
TZ=Asia/Shanghai \
PUID=1000 \
PGID=1000 \
Expand All @@ -20,33 +14,29 @@ COPY backend/requirements.txt .
RUN set -ex && \
apk add --no-cache \
bash \
ca-certificates \
coreutils \
curl \
jq \
netcat-openbsd \
procps-ng \
python3 \
py3-bcrypt \
py3-pip \
s6-overlay \
su-exec \
shadow \
tini \
tzdata && \
python3 -m pip install --no-cache-dir --upgrade pip && \
sed -i '/bcrypt/d' requirements.txt && \
pip install --no-cache-dir -r requirements.txt && \
# Add user
mkdir -p /home/ab && \
addgroup -S ab -g 911 && \
adduser -S ab -G ab -h /ab -s /bin/bash -u 911 && \
adduser -S ab -G ab -h /home/ab -s /sbin/nologin -u 911 && \
# Clear
rm -rf \
/ab/.cache \
/root/.cache \
/tmp/*

COPY --chmod=755 backend/src/. .
COPY --chmod=755 docker/ /
COPY --chmod=755 entrypoint.sh /entrypoint.sh

ENTRYPOINT [ "/init" ]
ENTRYPOINT ["tini", "-g", "--", "/entrypoint.sh"]

EXPOSE 7892
VOLUME [ "/app/config" , "/app/data" ]
Empty file.
7 changes: 0 additions & 7 deletions docker/etc/s6-overlay/s6-rc.d/init-fixuser/run

This file was deleted.

1 change: 0 additions & 1 deletion docker/etc/s6-overlay/s6-rc.d/init-fixuser/type

This file was deleted.

1 change: 0 additions & 1 deletion docker/etc/s6-overlay/s6-rc.d/init-fixuser/up

This file was deleted.

8 changes: 0 additions & 8 deletions docker/etc/s6-overlay/s6-rc.d/init-old-compatible/run

This file was deleted.

1 change: 0 additions & 1 deletion docker/etc/s6-overlay/s6-rc.d/init-old-compatible/type

This file was deleted.

1 change: 0 additions & 1 deletion docker/etc/s6-overlay/s6-rc.d/init-old-compatible/up

This file was deleted.

Empty file.
4 changes: 0 additions & 4 deletions docker/etc/s6-overlay/s6-rc.d/svc-autobangumi/finish

This file was deleted.

This file was deleted.

16 changes: 0 additions & 16 deletions docker/etc/s6-overlay/s6-rc.d/svc-autobangumi/run

This file was deleted.

1 change: 0 additions & 1 deletion docker/etc/s6-overlay/s6-rc.d/svc-autobangumi/type

This file was deleted.

Empty file.
Empty file.
Empty file.
15 changes: 15 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash
# shellcheck shell=bash

umask ${UMASK}

if [ -f /config/bangumi.json ]; then
mv /config/bangumi.json /app/data/bangumi.json
fi

groupmod -o -g "${PGID}" ab
usermod -o -u "${PUID}" ab

chown ab:ab -R /app /home/ab

exec su-exec "${PUID}:${PGID}" python3 main.py

0 comments on commit 152aa20

Please sign in to comment.