mirror of
https://github.com/0xJacky/nginx-ui.git
synced 2025-05-10 18:05:48 +02:00
feat(docker): integrate s6-overlay
This commit is contained in:
parent
02d279fa97
commit
9bd1507392
6 changed files with 37 additions and 17 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -2,6 +2,7 @@
|
|||
database.db
|
||||
tmp
|
||||
node_modules
|
||||
.pnpm-store
|
||||
app.ini
|
||||
dist
|
||||
*.exe
|
||||
|
|
28
Dockerfile
28
Dockerfile
|
@ -2,17 +2,31 @@ FROM --platform=$TARGETPLATFORM uozi/nginx-ui-base:latest
|
|||
ARG TARGETOS
|
||||
ARG TARGETARCH
|
||||
ARG TARGETVARIANT
|
||||
WORKDIR /app
|
||||
EXPOSE 80 443
|
||||
|
||||
COPY resources/docker/start.sh /app/start.sh
|
||||
# init config
|
||||
COPY resources/docker/init-config.up /etc/s6-overlay/s6-rc.d/init-config/up
|
||||
COPY resources/docker/init-config.sh /etc/s6-overlay/s6-rc.d/init-config/init-config.sh
|
||||
|
||||
RUN chmod +x /etc/s6-overlay/s6-rc.d/init-config/init-config.sh && \
|
||||
echo 'oneshot' > /etc/s6-overlay/s6-rc.d/init-config/type && \
|
||||
touch /etc/s6-overlay/s6-rc.d/user/contents.d/init-config && \
|
||||
mkdir -p /etc/s6-overlay/s6-rc.d/nginx/dependencies.d && \
|
||||
touch /etc/s6-overlay/s6-rc.d/nginx/dependencies.d/init-config
|
||||
|
||||
# register nginx-ui service
|
||||
COPY resources/docker/nginx-ui.run /etc/s6-overlay/s6-rc.d/nginx-ui/run
|
||||
RUN echo 'longrun' > /etc/s6-overlay/s6-rc.d/nginx-ui/type && \
|
||||
touch /etc/s6-overlay/s6-rc.d/user/contents.d/nginx-ui
|
||||
|
||||
# copy nginx config
|
||||
COPY resources/docker/nginx.conf /usr/etc/nginx/nginx.conf
|
||||
COPY resources/docker/nginx-ui.conf /usr/etc/nginx/conf.d/nginx-ui.conf
|
||||
COPY resources/docker/nginx-ui.conf /etc/nginx/conf.d/nginx-ui.conf
|
||||
COPY nginx-ui-$TARGETOS-$TARGETARCH$TARGETVARIANT/nginx-ui /app/nginx-ui
|
||||
|
||||
RUN cd /app && chmod a+x /app/start.sh \
|
||||
&& rm -f /etc/nginx/conf.d/default.conf \
|
||||
# copy nginx-ui executable binary
|
||||
COPY nginx-ui-$TARGETOS-$TARGETARCH$TARGETVARIANT/nginx-ui /usr/local/bin/nginx-ui
|
||||
|
||||
# remove default nginx config
|
||||
RUN rm -f /etc/nginx/conf.d/default.conf \
|
||||
&& rm -f /usr/etc/nginx/conf.d/default.conf
|
||||
|
||||
ENTRYPOINT ["./start.sh"]
|
||||
|
|
12
resources/docker/init-config.sh
Normal file
12
resources/docker/init-config.sh
Normal file
|
@ -0,0 +1,12 @@
|
|||
#!/bin/bash
|
||||
|
||||
# the up and down files are special: they're not shell scripts,
|
||||
# but single command lines interpreted by execlineb.
|
||||
# You should not have to worry about execline;
|
||||
# you should only remember that an up file contains a single command line.
|
||||
|
||||
if [ "$(ls -A /etc/nginx)" = "" ]; then
|
||||
echo "[INFO] Initialing Nginx configurations directory"
|
||||
cp -rp /usr/etc/nginx/* /etc/nginx/
|
||||
echo "[INFO] Nginx configurations directory initialed"
|
||||
fi
|
1
resources/docker/init-config.up
Normal file
1
resources/docker/init-config.up
Normal file
|
@ -0,0 +1 @@
|
|||
/etc/s6-overlay/s6-rc.d/init-config/init-config.sh
|
2
resources/docker/nginx-ui.run
Normal file
2
resources/docker/nginx-ui.run
Normal file
|
@ -0,0 +1,2 @@
|
|||
#!/bin/sh
|
||||
nginx-ui --config /etc/nginx-ui/app.ini
|
|
@ -1,10 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
if [ "$(ls -A /etc/nginx)" = "" ]; then
|
||||
echo "Initialing Nginx config dir"
|
||||
cp -rp /usr/etc/nginx/* /etc/nginx/
|
||||
echo "Initialed Nginx config dir"
|
||||
fi
|
||||
|
||||
nginx &
|
||||
/app/nginx-ui --config /etc/nginx-ui/app.ini
|
Loading…
Add table
Add a link
Reference in a new issue