Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: from s6-overlay change to tini and su-exec #434

Merged
merged 1 commit into from
Aug 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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" ]
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