mirror of
https://github.com/Tzahi12345/YoutubeDL-Material.git
synced 2026-04-24 01:13:19 +03:00
Merge pull request #117 from SuperSandro2000/docker-fix
Docker: Fix startup error in entrypoint, ownership of node_modules
This commit is contained in:
@@ -1,9 +1,9 @@
|
|||||||
FROM alpine:3.12
|
FROM alpine:3.12
|
||||||
|
|
||||||
ENV UID=1000 GID=1000
|
ENV UID=1000 \
|
||||||
RUN export user=youtube \
|
GID=1000 \
|
||||||
&& addgroup -S $user -g $GID && adduser -D -S $user -G $user -u $UID
|
USER=youtube
|
||||||
USER $user
|
RUN addgroup -S $USER -g $GID && adduser -D -S $USER -G $USER -u $UID
|
||||||
|
|
||||||
RUN apk add --no-cache \
|
RUN apk add --no-cache \
|
||||||
ffmpeg \
|
ffmpeg \
|
||||||
@@ -13,6 +13,8 @@ RUN apk add --no-cache \
|
|||||||
&& apk add --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing/ \
|
&& apk add --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing/ \
|
||||||
atomicparsley
|
atomicparsley
|
||||||
|
|
||||||
|
# switch to default user to not chown node_modules on startup
|
||||||
|
USER $USER
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
COPY --chown=$UID:$GID [ "package.json", "package-lock.json", "/app/" ]
|
COPY --chown=$UID:$GID [ "package.json", "package-lock.json", "/app/" ]
|
||||||
@@ -21,5 +23,7 @@ RUN npm install
|
|||||||
COPY --chown=$UID:$GID [ "./", "/app/" ]
|
COPY --chown=$UID:$GID [ "./", "/app/" ]
|
||||||
|
|
||||||
EXPOSE 17442
|
EXPOSE 17442
|
||||||
|
# switch back to root to allow UID/GID changing
|
||||||
|
USER root
|
||||||
ENTRYPOINT [ "/app/entrypoint.sh" ]
|
ENTRYPOINT [ "/app/entrypoint.sh" ]
|
||||||
CMD [ "node", "app.js" ]
|
CMD [ "node", "app.js" ]
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ if [ "${1#-}" != "$1" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# chown current working directory to current user
|
# chown current working directory to current user
|
||||||
if [ "$@" = "$CMD" ] && [ "$(id -u)" = "0" ]; then
|
if [ "$*" = "$CMD" ] && [ "$(id -u)" = "0" ]; then
|
||||||
find . \! -user "$UID" -exec chown "$UID:$GID" -R '{}' +
|
find . \! -user "$UID" -exec chown "$UID:$GID" -R '{}' +
|
||||||
exec su-exec "$UID:$GID" "$0" "$@"
|
exec su-exec "$UID:$GID" "$0" "$@"
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user