Skip to content

Commit

Permalink
refs #23 Add entrypoint to set proper user permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
elboletaire committed Mar 20, 2024
1 parent d77b3ca commit 0432784
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
1 change: 1 addition & 0 deletions .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ jobs:
uses: docker/build-push-action@v5
with:
context: .
file: docker/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
Expand Down
7 changes: 5 additions & 2 deletions Dockerfile → docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ WORKDIR /app
RUN mkdir /downloads

# Copy the pre-built binary file from the previous stage
COPY --from=builder /app/manga-downloader .
COPY --from=builder /app/manga-downloader /usr/bin/manga-downloader

COPY /docker/entrypoint.sh /usr/bin/entrypoint.sh
RUN chmod +x /usr/bin/entrypoint.sh

# Set manga-downloader as the entrypoint
ENTRYPOINT ["./manga-downloader", "-o", "/downloads"]
ENTRYPOINT ["/usr/bin/entrypoint.sh", "-o", "/downloads"]
11 changes: 11 additions & 0 deletions docker/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/sh

# default user id and group id
USER_ID=${USER_ID:-1000}
GROUP_ID=${GROUP_ID:-1000}

# execute the manga-downloader binary with all arguments passed to this script
manga-downloader "$@"

# Set ownership to USER_ID:GROUP_ID for /downloads
chown -R ${USER_ID}:${GROUP_ID} /downloads

0 comments on commit 0432784

Please sign in to comment.