Skip to content

Commit

Permalink
Reorder 'USER' command (MiczFlor#2199)
Browse files Browse the repository at this point in the history
This makes sure the 'venv' is initalized using the correct user, preventing permission errors

Closes issue MiczFlor#2198

Co-authored-by: pre-commit fix Vito Zanotelli <[email protected]>
  • Loading branch information
votti and pre-commit fix Vito Zanotelli authored Jan 2, 2024
1 parent 3a904b5 commit c713610
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions docker/jukebox.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,18 @@ RUN apt-get update && apt-get install -qq -y \
espeak mpc mpg123 git ffmpeg spi-tools netcat \
python3 python3-venv python3-dev python3-mutagen

# Copy in the source code using the correct permissions
COPY --chown=${USER}:${USER} . ${INSTALLATION_PATH}/

# Switch to the `$USER` (typically `pi`)
USER ${USER}
WORKDIR ${HOME}

# Initialize venv
ENV VIRTUAL_ENV=${INSTALLATION_PATH}/.venv
RUN python3 -m venv $VIRTUAL_ENV
ENV PATH="$VIRTUAL_ENV/bin:$PATH"

USER ${USER}
WORKDIR ${HOME}
COPY --chown=${USER}:${USER} . ${INSTALLATION_PATH}/

RUN pip install --no-cache-dir -r ${INSTALLATION_PATH}/requirements.txt

Expand Down

0 comments on commit c713610

Please sign in to comment.