Skip to content

Commit

Permalink
Trying to change user to verdaccio in dockerfile - Crashes the container
Browse files Browse the repository at this point in the history
Reached out to verdaccio Discord
https://discord.com/channels/388674437219745793/1235628971224465478

Docker-compose linting error, issue opened:
docker/compose#11787
  • Loading branch information
DeanAyalon committed May 2, 2024
1 parent 83ff3d8 commit 5edbd4a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# name: ${PROJECT}
name: ${PROJECT}
services:
verdaccio:
build:
Expand Down
13 changes: 10 additions & 3 deletions dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,18 @@ USER root
RUN apk update && apk add curl

# Copy files into container
COPY --chown=root:root files/conf/config.yaml /verdaccio/conf/config.yaml
COPY --chown=root:root files/scripts/* /verdaccio/scripts/
COPY --chown=$VERDACCIO_USER_UID:root files/conf/config.yaml /verdaccio/conf/config.yaml
COPY --chown=$VERDACCIO_USER_UID:root files/scripts/* /verdaccio/scripts/
# Script execution permissions
# RUN chown root:root /verdaccio/scripts/*
RUN chmod u+x /verdaccio/scripts/*

# Added this, in case the verdaccio user crashes due to having no access to the verdaccio dir
## It did not solve the problem
RUN chown $VERDACCIO_USER_UID:root -R /verdaccio

# When this step is enabled, the contianer immediately exits with code 2, no logs, no errors
# USER $VERDACCIO_USER_UID
# This step is to avoid the root privileges warning - Verdaccio runs perfectly without it

HEALTHCHECK --interval=30s --timeout=3s \
CMD /verdaccio/scripts/healthcheck.sh

0 comments on commit 5edbd4a

Please sign in to comment.