Skip to content

Commit

Permalink
refactoring (docker): removed dev dockerfile, refactored dockerfile t…
Browse files Browse the repository at this point in the history
…o a more general one

- renamed websocket routes in mopidy service
- refactored workflows
  • Loading branch information
Mario Lukas committed Feb 3, 2023
1 parent c940b0a commit f556eae
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 137 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build-docker-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
- name: Clone repository
uses: actions/checkout@v2
with:
ref: ${{ github.ref_name }}
ref: ${{ github.event.client_payload.tag }}

- name: Set up QEMU
uses: docker/setup-qemu-action@v1
Expand All @@ -35,4 +35,4 @@ jobs:
platforms: linux/amd64,linux/armhf
file: docker/Dockerfile
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/hydraplay:${{ github.ref_name }},${{ secrets.DOCKERHUB_USERNAME }}/hydraplay:latest
tags: ${{ secrets.DOCKERHUB_USERNAME }}/hydraplay:${{ github.event.client_payload.tag }},${{ secrets.DOCKERHUB_USERNAME }}/hydraplay:latest
5 changes: 3 additions & 2 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
rm snapweb-0.2.0.zip
rm -R snapweb-0.2.0
- name: zip dist
run: zip -r hydraplay-${{ steps.vars.outputs.tag }}.zip . -x "src/ui/*" ".git/*" ".github/*" ".gitignore" "docker-compose.inst-dev.yml" "docker-compose.ui-dev.yml"
run: zip -r hydraplay-${{ steps.vars.outputs.tag }}.zip . -x "doc/*" "snapweb/*" "src/ui/*" ".git/*" "docker/*" "src/extras/*" ".github/*" ".gitignore" "docker-compose.inst-dev.yml" "docker-compose.ui-dev.yml"
- name: Create Release
id: create_release
uses: actions/create-release@v1
Expand All @@ -77,4 +77,5 @@ jobs:
- name: Trigger Docker image build workflow
uses: peter-evans/repository-dispatch@v2
with:
event-type: build-docker-image
event-type: build-docker-image
client-payload: '{"tag": "${{ steps.vars.outputs.tag }}"}'
6 changes: 3 additions & 3 deletions docker-compose.ui-dev.yml → docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ services:
#image: mariolukas/hydraplay:latest
build:
context: .
dockerfile: docker/Dockerfile.ui.dev
dockerfile: docker/Dockerfile
target: hydraplay
args:
SNAPCASTVERSION: 0.26.0
Expand All @@ -33,8 +33,8 @@ services:
- 6680-6690:6680-6690
volumes:
# mount src folder for development
- ./src/:/app/
- ./src/:/test/
- ./hydra.private.json:/tmp/hydra.config.json
- ./pipes/:/tmp/additional_streams
- ./mp3:/media
entrypoint: ["python3", "-u", "/app/hydraplay.sh", "--config", "/tmp/hydra.config.json", "--loglevel", "debug"]
entrypoint: ["python3", "-u", "/test/hydraplay.sh", "--config", "/tmp/hydra.config.json", "--loglevel", "debug"]
45 changes: 17 additions & 28 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,22 +1,3 @@
FROM node:16-alpine as build-frontend
ARG TARGETARCH

RUN mkdir -p /ui

WORKDIR /ui

COPY src/ui/package.json /ui
COPY src/ui/package-lock.json /ui
COPY src/hydraplay /hydraplay
RUN npm install -g @angular/cli -g --silent

RUN npm ci

COPY src/ui /ui

RUN ng build


FROM debian:bullseye-slim as hydraplay
ARG TARGETARCH

Expand All @@ -28,6 +9,8 @@ RUN apt-get update && \
gcc \
gnupg \
git \
unzip \
jq \
ca-certificates \
python3 \
python3-pip \
Expand All @@ -53,12 +36,7 @@ RUN apt-get update && \
&& python3 -m pip install --upgrade youtube-dl \
&& python3 -m pip install Mopidy-Bandcamp \
&& python3 -m pip install Mopidy-Local \
&& python3 -m pip install jinja2 tornado \
&& apt-get remove -y \
gcc \
python3-pip \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* ~/.cache

&& python3 -m pip install jinja2 tornado

#======================================= INSTALL SPOTIFY WORKAROUND ==============================================#

Expand All @@ -76,6 +54,16 @@ RUN git clone --depth 1 -b gstspotifysrc-hack https://github.com/kingosticks/mop
&& cd .. \
&& rm -rf mopidy-spotify

#======================================= HYDRAPLAY INSTALLATION ==================================================#

RUN export LATEST_RELEASE_VER=$(curl -sL https://api.github.com/repos/mariolukas/HydraPlay/releases/latest | jq -r ".tag_name") \
&& export LATEST_RELEASE_ZIP=$(curl -sL https://api.github.com/repos/mariolukas/HydraPlay/releases/latest | jq -r ".assets[].browser_download_url") \
&& wget ${LATEST_RELEASE_ZIP} \
&& mkdir -p /tmp/hydraplay \
&& mkdir -p /app \
&& unzip hydraplay-${LATEST_RELEASE_VER}.zip "src/*" -d /tmp/hydraplay/ \
&& cp -R /tmp/hydraplay/src/* /app/.

#======================================= SNAPCAST INSTALLATION ===================================================#

ARG SNAPCASTVERSION=0.26.0
Expand All @@ -91,7 +79,6 @@ RUN export SNAPCAST_ARCH=$TARGETARCH \
&& wget https://github.com/badaix/snapcast/releases/download/v${SNAPCASTVERSION}/snapserver_${SNAPCASTVERSION}-1_${SNAPCAST_ARCH}.deb \
&& dpkg -i --force-all snapserver_${SNAPCASTVERSION}-1_${SNAPCAST_ARCH}.deb \
&& apt-get -f install -y\
&& mkdir -p /app \
&& mkdir -p /media \
&& mkdir -p /root/.config/snapcast/ \
&& touch /tmp/hydra.config.json \
Expand All @@ -102,10 +89,12 @@ RUN export SNAPCAST_ARCH=$TARGETARCH \
wget \
git \
curl \
jq \
unzip \
gcc \
python3-pip \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* ~/.cache

COPY --from=0 /hydraplay /app/hydraplay

#======================================= General Docker configs ===================================================#

EXPOSE 1705
Expand Down
101 changes: 0 additions & 101 deletions docker/Dockerfile.ui.dev

This file was deleted.

2 changes: 1 addition & 1 deletion src/ui/src/app/services/mopidy.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export class MopidyPlayer {
let wsUrl = `${this.wsProtocol}${url.hostname}:${this.mopidyPort}/mopidy/ws`;

if (hydraplay_config['ws_uri_proxy']) {
wsUrl = `${this.wsProtocol}${url.hostname}/stream/${this.index}/mopidy/ws/`;
wsUrl = `${this.wsProtocol}${url.hostname}/stream/${this.index}/mopidy/ws`;
}

this.mopidy$ = new Mopidy({
Expand Down

0 comments on commit f556eae

Please sign in to comment.