Skip to content

Commit

Permalink
Drop root during base image build and use venv (#1682)
Browse files Browse the repository at this point in the history
  • Loading branch information
kbirger authored Sep 29, 2024
1 parent bc70e29 commit fcf07cb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ on:

env:
PYTHON_VERSION: "3.11"
BASE_IMAGE_VERSION_STABLE: "1.0.10"
BASE_IMAGE_VERSION_BETA: "1.0.10"
BASE_IMAGE_VERSION_STABLE: "1.1.0"
BASE_IMAGE_VERSION_BETA: "1.1.0"

jobs:
build-artifact:
Expand Down
18 changes: 12 additions & 6 deletions Dockerfile.base
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,24 @@ RUN set -x \
RUN mkdir -p /usr/local/bin/widevine_cdm
COPY widevine_cdm/* /usr/local/bin/widevine_cdm/

# Upgrade pip + Install uv
RUN pip install --upgrade pip \
&& pip install uv==0.2.27
RUN adduser -D app app \
&& chmod -R 775 /tmp \
&& chgrp -R app /tmp

WORKDIR /home/app
USER app


# Configure runtime environmental variables
ENV LD_PRELOAD="/usr/lib/libjemalloc.so.2"
ENV VIRTUAL_ENV=/opt/venv
ENV VIRTUAL_ENV=/home/app/venv

# create venv and set some permissions to allow running the container as non-root
RUN python3 -m venv $VIRTUAL_ENV && \
chmod -R 777 $VIRTUAL_ENV && \
chmod -R 777 /tmp

source $VIRTUAL_ENV/bin/activate && \
pip install --upgrade pip \
&& pip install uv==0.4.17

Check warning on line 49 in Dockerfile.base

View workflow job for this annotation

GitHub Actions / Builds and pushes the Music Assistant base container to ghcr.io

Empty continuation lines will become errors in a future release

NoEmptyContinuation: Empty continuation line More info: https://docs.docker.com/go/dockerfile/rule/no-empty-continuation/

Check warning on line 49 in Dockerfile.base

View workflow job for this annotation

GitHub Actions / Builds and pushes the Music Assistant base container to ghcr.io

Empty continuation lines will become errors in a future release

NoEmptyContinuation: Empty continuation line More info: https://docs.docker.com/go/dockerfile/rule/no-empty-continuation/

ENV PATH="$VIRTUAL_ENV/bin:$PATH"
WORKDIR $VIRTUAL_ENV
Expand Down

0 comments on commit fcf07cb

Please sign in to comment.