Skip to content
This repository has been archived by the owner on Feb 11, 2023. It is now read-only.

Commit

Permalink
Merge pull request #11 from linuxserver-labs/3.17
Browse files Browse the repository at this point in the history
  • Loading branch information
thespad committed Jan 23, 2023
2 parents 77efb27 + b69fc7a commit 35c0833
Show file tree
Hide file tree
Showing 19 changed files with 89 additions and 81 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/call-baseimage-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
with:
repo_owner: ${{ github.repository_owner }}
baseimage: "alpine-nginx"
basebranch: "3.15"
basebranch: "3.17"
app_name: "your_spotify"
secrets:
repo_release_token: ${{ secrets.repo_release_token }}
37 changes: 14 additions & 23 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
FROM ghcr.io/linuxserver/baseimage-alpine:3.15 as server-buildstage
# syntax=docker/dockerfile:1

FROM ghcr.io/linuxserver/baseimage-alpine:3.17 as server-buildstage

# set version label
ARG BUILD_DATE
Expand All @@ -9,11 +11,6 @@ RUN \
apk -U --update --no-cache add --virtual=server-build-dependencies \
build-base \
cmake \
curl \
gcc \
g++ \
jq \
make \
npm \
python3-dev \
yarn && \
Expand All @@ -25,11 +22,11 @@ RUN \
curl -o \
/tmp/your_spotify.tar.gz -L \
"https://github.com/Yooooomi/your_spotify/archive/${APP_VERSION}.tar.gz" && \
mkdir -p /app/your_spotify && \
mkdir -p /app/www && \
tar xzf \
/tmp/your_spotify.tar.gz -C \
/app/your_spotify/ --strip-components=1 && \
cd /app/your_spotify/server && \
/app/www/ --strip-components=1 && \
cd /app/www/server && \
sed -i '/"extends": "..\/tsconfig.json"/d' tsconfig.json && \
yarn --dev --frozen-lockfile && \
yarn build && \
Expand All @@ -39,25 +36,22 @@ RUN \
rm -rf \
/tmp/*

FROM ghcr.io/linuxserver/baseimage-alpine:3.15 as client-buildstage
FROM ghcr.io/linuxserver/baseimage-alpine:3.17 as client-buildstage

ARG NODE_ENV
ENV NODE_ENV ${NODE_ENV:-production}

COPY --from=server-buildstage /app/your_spotify/client /app/your_spotify/client
COPY --from=server-buildstage /app/www/client /app/www/client

RUN \
apk -U --update --no-cache add --virtual=client-build-dependencies \
build-base \
cmake \
gcc \
g++ \
make \
npm \
python3-dev \
yarn && \
echo "*** install your_spotify client ***" && \
cd /app/your_spotify/client && \
cd /app/www/client && \
sed -i '/"extends": "..\/tsconfig.json"/d' tsconfig.json && \
npm install -g nodemon && \
yarn --production=false --frozen-lockfile --network-timeout 60000 && \
Expand All @@ -68,7 +62,7 @@ RUN \
rm -rf \
/tmp/*

FROM ghcr.io/linuxserver/baseimage-alpine-nginx:3.15
FROM ghcr.io/linuxserver/baseimage-alpine-nginx:3.17

ARG BUILD_DATE
ARG VERSION
Expand All @@ -77,24 +71,21 @@ LABEL maintainer="thespad"

ENV HOME=/app

COPY --from=client-buildstage /app/your_spotify/client/build/ /app/your_spotify/client/build/
COPY --from=server-buildstage /app/your_spotify/server/package.json /app/your_spotify/server/package.json
COPY --from=server-buildstage /app/your_spotify/server/lib/ /app/your_spotify/server/lib/
COPY --from=client-buildstage /app/www/client/build/ /app/www/client/build/
COPY --from=server-buildstage /app/www/server/package.json /app/www/server/package.json
COPY --from=server-buildstage /app/www/server/lib/ /app/www/server/lib/

RUN \
apk -U --update --no-cache add --virtual=build-dependencies \
build-base \
cmake \
gcc \
g++ \
python3-dev && \
apk add -U --update --no-cache \
curl \
nodejs \
npm \
yarn && \
npm install -g serve && \
cd /app/your_spotify/server && \
cd /app/www/server && \
yarn --production && \
yarn cache clean && \
apk del --purge \
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -246,4 +246,5 @@ Once registered you can define the dockerfile to use with `-f Dockerfile.aarch64

## Versions

* **23.01.23:** - Rebase to Alpine 3.17, migrate to s6v3.
* **23.02.22:** - Initial Release.
39 changes: 0 additions & 39 deletions release-versions/alpine-nginx-master.txt

This file was deleted.

40 changes: 40 additions & 0 deletions root/app/your_spotify/client/build/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<html>
<head>
<title>Upgrade Required!</title>
<style>
body{
font-family: Helvetica, Arial, sans-serif;
}
.message{
width:440px;
padding:20px 40px;
margin:0 auto;
background-color:#f9f9f9;
border:1px solid #ddd;
color: #1e3d62;
}
center{
margin:40px 0;
}
h1{
font-size: 18px;
line-height: 26px;
}
p{
font-size: 12px;
}
a{
color: rgb(207, 48, 139);
}
</style>
</head>
<body>
<div class="message">
<h1>Upgrade Required!</h1>
<p>The application inside this image has been moved to a new folder.</p>
<p>You will need to update your <strong>/config/nginx/nginx.conf</strong> and <strong>/config/nginx/site-confs/default.conf</strong> in order for the application to work.</p>
<p>New config samples are located at <strong>/config/nginx/nginx.conf.sample</strong> and <strong>/config/nginx/site-confs/default.conf.sample</strong></p>
<p>Please review our announcement: <a target="_blank" href="https://info.linuxserver.io/issues/2022-08-20-nginx-base/">Significant changes to nginx based images</a></p>
</div>
</body>
</html>
2 changes: 1 addition & 1 deletion root/defaults/nginx/site-confs/default.conf.sample
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ server {

listen 443 ssl;

root /app/your_spotify/client/build;
root /app/www/client/build;
index index.php index.html index.htm;

server_name _;
Expand Down
12 changes: 6 additions & 6 deletions root/etc/cont-init.d/50-config → ...rlay/s6-rc.d/init-your_spotify-config/run
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
#!/usr/bin/with-contenv bash
# shellcheck shell=bash

VAR_PATH="/app/your_spotify/client/build"
VAR_PATH="/app/www/client/build"

cp "$VAR_PATH/variables.js" "$VAR_PATH/variables-final.js"
cp "$VAR_PATH/variables-template.js" "$VAR_PATH/variables.js"

export API_ENDPOINT="${APP_URL}/api"

if [ -n "$API_ENDPOINT" ]
then
if [[ -n "$API_ENDPOINT" ]]; then
echo "Setting API Endpoint to '$API_ENDPOINT'"
sed -i "s;__API_ENDPOINT__;$API_ENDPOINT;g" "$VAR_PATH/variables-final.js"
sed -i "s;__API_ENDPOINT__;$API_ENDPOINT;g" "$VAR_PATH/variables.js"
else
echo "API_ENDPOINT is not defined, web app won't work"
exit 1
fi

HOME="/app"

chown -R abc:abc \
lsiown -R abc:abc \
/app
1 change: 1 addition & 0 deletions root/etc/s6-overlay/s6-rc.d/init-your_spotify-config/type
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
oneshot
1 change: 1 addition & 0 deletions root/etc/s6-overlay/s6-rc.d/init-your_spotify-config/up
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/etc/s6-overlay/s6-rc.d/init-your_spotify-config/run
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3
11 changes: 11 additions & 0 deletions root/etc/s6-overlay/s6-rc.d/svc-your_spotify/run
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/with-contenv bash
# shellcheck shell=bash

export API_ENDPOINT="${APP_URL}/api"
export CLIENT_ENDPOINT="${APP_URL}"

s6-setuidgid abc yarn --cwd /app/www/server migrate

exec \
s6-notifyoncheck -d -n 300 -w 1000 -c "nc -z localhost 8000" \
cd /app/www/server s6-setuidgid abc yarn start
1 change: 1 addition & 0 deletions root/etc/s6-overlay/s6-rc.d/svc-your_spotify/type
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
longrun
Empty file.
Empty file.
11 changes: 0 additions & 11 deletions root/etc/services.d/your_spotify_server/run

This file was deleted.

11 changes: 11 additions & 0 deletions root/migrations/02-default-location
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/with-contenv bash
# shellcheck shell=bash

DEFAULT_CONF="/config/nginx/site-confs/default.conf"
OLD_ROOT="root /app/your_spotify/client/build;"
NEW_ROOT="root /app/www/client/build;"

if grep -q "${OLD_ROOT}" "${DEFAULT_CONF}" 2>/dev/null; then
echo "updating root in ${DEFAULT_CONF}"
sed -i "s|${OLD_ROOT}|${NEW_ROOT}|" "${DEFAULT_CONF}"
fi

0 comments on commit 35c0833

Please sign in to comment.