diff --git a/.github/workflows/publish-release.yaml b/.github/workflows/publish-release.yaml index 466fd3b..f193998 100644 --- a/.github/workflows/publish-release.yaml +++ b/.github/workflows/publish-release.yaml @@ -36,10 +36,6 @@ jobs: $(docker manifest inspect ghcr.io/${{ github.repository }}:$VERSION > /dev/null) || NOT_PREVIOUSLY_PUBLISHED=1 echo "::set-output name=NOT_PREVIOUSLY_PUBLISHED::$NOT_PREVIOUSLY_PUBLISHED" - - name: Update Version in Code - run: | - sed -i 's/insert-version/${{ steps.gathervars.outputs.VERSION }}/g' ./src/routes/settings.html.svelte - - name: Log in to the Container registry uses: docker/login-action@v1 if: ${{ steps.gathervars.outputs.NOT_PREVIOUSLY_PUBLISHED != 0 }} diff --git a/docker/production/dockerfile b/docker/production/dockerfile index 55597e7..f184ab6 100644 --- a/docker/production/dockerfile +++ b/docker/production/dockerfile @@ -1,7 +1,7 @@ # arguments ARG VERSION="master" -FROM node:latest AS build +FROM node:current-alpine AS build #environment variables ENV PROJECT_NAME="headscale-ui" @@ -24,6 +24,10 @@ RUN chmod -R 755 scripts # Build the image. This build runs as root RUN /staging/scripts/1-image-build.sh +##### +## Second Image +##### + FROM alpine:latest #environment variables diff --git a/docker/production/scripts/1-image-build.sh b/docker/production/scripts/1-image-build.sh index bb4921f..a46d153 100644 --- a/docker/production/scripts/1-image-build.sh +++ b/docker/production/scripts/1-image-build.sh @@ -1,6 +1,11 @@ #!/bin/sh set -x +# add dependencies +# jq for parsing version information +# git for cloning the repository +apk add --no-cache jq git + #clone the project git clone ${PROJECT_URL} ${PROJECT_NAME} @@ -8,5 +13,9 @@ git clone ${PROJECT_URL} ${PROJECT_NAME} cd ${PROJECT_NAME} npm install +# inject the version number +VERSION=$(jq -r '.version' package.json) +sed -i "s/insert-version/${VERSION}/g" ./src/routes/settings.html.svelte + # build the project npm run build \ No newline at end of file