Skip to content

Commit

Permalink
🐳 Use alpine base image
Browse files Browse the repository at this point in the history
  • Loading branch information
cristianpb committed Mar 5, 2024
1 parent d337595 commit 824511a
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 7 deletions.
12 changes: 11 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,24 @@ jobs:
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Build and export to Docker
uses: docker/build-push-action@v5
with:
context: .
load: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
target: prod
build-args: |
app_path=/muse
- name: Build and push docker image
uses: docker/build-push-action@v5
if: startsWith(github.event.ref, 'refs/tags')
with:
context: .
file: ./Dockerfile
push: true
platforms: linux/amd64,linux/arm64
platforms: linux/amd64,linux/arm64,linux/arm/v7
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
target: prod
Expand Down
29 changes: 24 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
##########################################################
FROM cristianpb/mopidy-base as muse
FROM alpine as base

RUN apk update \
&& apk upgrade \
&& apk add --no-cache \
gstreamer \
mopidy \
py-pip \
alpine-sdk \
python3-dev\
dumb-init \
curl

RUN pip3 install --upgrade --break-system-packages pip \
&& pip3 install --break-system-packages --no-cache-dir Mopidy-TuneIn Mopidy-Local Mopidy-Podcast Mopidy-Podcast \
&& rm -rf ~/.cache/pip

##########################################################
FROM base as muse
ARG app_path

# Base dir /app
Expand All @@ -12,15 +30,16 @@ COPY README.md ./
COPY pyproject.toml ./
ADD ./mopidy_muse ./mopidy_muse

#VOLUME /${app_path}/mopidy_muse/static
#VOLUME ${app_path}/mopidy_muse/static

RUN pip install --upgrade pip && pip install -e .
RUN pip3 install --break-system-packages -e .

EXPOSE 6680
CMD ["mopidy"]

##########################################################
FROM cristianpb/mopidy-base as prod
FROM base as prod
ARG app_path

# Base dir /app
WORKDIR $app_path
Expand All @@ -33,7 +52,7 @@ COPY pyproject.toml ./
ADD ./mopidy_muse ./mopidy_muse
ADD ./build ./mopidy_muse/static

RUN pip install --upgrade pip && pip install -e .
RUN pip install --break-system-packages -e .

EXPOSE 6680
CMD ["mopidy"]
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ dist:
sudo mkdir -p ${APP_PATH}/dist ; sudo chmod g+rw ${APP_PATH}/dist/.; sudo chgrp 1000 ${APP_PATH}/dist/.;

build-python: dist build
docker-compose run --rm mopidy /bin/bash -c 'pip install -q build && python3 -m build'
docker-compose run --rm mopidy /bin/sh -c 'pip install --break-system-packages -q build && python3 -m build'

mopidy-local-scan:
docker exec -it ${APP} mopidy local scan
Expand Down

0 comments on commit 824511a

Please sign in to comment.