From 6a461af8488fe63c54237cae7d80a30b29ff4c0c Mon Sep 17 00:00:00 2001 From: IRHM <37304121+IRHM@users.noreply.github.com> Date: Wed, 1 Nov 2023 22:20:05 +0000 Subject: [PATCH 1/5] use node:20 as base image for runner step updated ui builder step to node:20 too --- Dockerfile | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/Dockerfile b/Dockerfile index 7b31d9ae..b81a618e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,7 +7,7 @@ COPY server/*.go server/go.* ./ RUN go mod download && GOOS=linux go build -o ./watcharr # Frontend -FROM node:19 AS ui +FROM node:20 AS ui WORKDIR /app COPY package*.json vite.config.ts svelte.config.js tsconfig.json ./ @@ -17,19 +17,7 @@ COPY ./static ./static RUN npm install && npm run build # Production -FROM debian:12.0 AS runner - -RUN apt-get update && apt-get install ca-certificates -y - -ENV NODE_VERSION=18.13.0 -RUN apt install -y curl -RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash -ENV NVM_DIR=/root/.nvm -RUN . "$NVM_DIR/nvm.sh" && nvm install ${NODE_VERSION} -RUN . "$NVM_DIR/nvm.sh" && nvm use v${NODE_VERSION} -RUN . "$NVM_DIR/nvm.sh" && nvm alias default v${NODE_VERSION} -ENV PATH="/root/.nvm/versions/node/v${NODE_VERSION}/bin/:${PATH}" -RUN node --version +FROM node:20 AS runner COPY --from=server /server/watcharr / COPY --from=ui /app/build /ui From 21a2dc1bf4d6816e3bb2e51f598a45553e602eba Mon Sep 17 00:00:00 2001 From: IRHM <37304121+IRHM@users.noreply.github.com> Date: Wed, 1 Nov 2023 22:21:02 +0000 Subject: [PATCH 2/5] 1.21.1-dev --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index b4b1a9a1..4afd94d1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "watcharr", - "version": "1.21.0", + "version": "1.21.1-dev", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "watcharr", - "version": "1.21.0", + "version": "1.21.1-dev", "dependencies": { "axios": "^1.6.0" }, diff --git a/package.json b/package.json index c5ab2d56..086894c7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "watcharr", - "version": "1.21.0", + "version": "1.21.1-dev", "private": true, "scripts": { "dev": "vite dev", From a3559381bd1514945395620e430ddd157473ae13 Mon Sep 17 00:00:00 2001 From: IRHM <37304121+IRHM@users.noreply.github.com> Date: Wed, 1 Nov 2023 23:48:23 +0000 Subject: [PATCH 3/5] omit dev dependencies in runner step --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index b81a618e..8a595889 100644 --- a/Dockerfile +++ b/Dockerfile @@ -22,7 +22,7 @@ FROM node:20 AS runner COPY --from=server /server/watcharr / COPY --from=ui /app/build /ui COPY --from=ui /app/package.json /app/package-lock.json /ui -RUN cd /ui && npm ci +RUN cd /ui && npm ci --omit=dev EXPOSE 3080 From fab012ae09bf638d098912cb1811fde66bab7fbe Mon Sep 17 00:00:00 2001 From: IRHM <37304121+IRHM@users.noreply.github.com> Date: Thu, 2 Nov 2023 00:18:40 +0000 Subject: [PATCH 4/5] move to alpine base images image is half of original size now too very nice - 500MB -> 1.2GB -> 200MB --- Dockerfile | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8a595889..3dc5c9f8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,13 +1,16 @@ # Backend -FROM golang:1.21 AS server +FROM golang:1.21-alpine AS server WORKDIR /server COPY server/*.go server/go.* ./ -RUN go mod download && GOOS=linux go build -o ./watcharr +# Required so we can build with cgo +RUN apk update && apk add --no-cache musl-dev gcc build-base + +RUN go mod download && GOOS=linux CGO_ENABLED=1 go build -o ./watcharr # Frontend -FROM node:20 AS ui +FROM node:20-alpine AS ui WORKDIR /app COPY package*.json vite.config.ts svelte.config.js tsconfig.json ./ @@ -17,7 +20,7 @@ COPY ./static ./static RUN npm install && npm run build # Production -FROM node:20 AS runner +FROM node:20-alpine AS runner COPY --from=server /server/watcharr / COPY --from=ui /app/build /ui From d1f2255f655f640e1c7d4c1a317f0ed9944b74d7 Mon Sep 17 00:00:00 2001 From: IRHM <37304121+IRHM@users.noreply.github.com> Date: Thu, 2 Nov 2023 00:22:07 +0000 Subject: [PATCH 5/5] workflows: Remove `workflow_dispatch` trigger from container-release.yml --- .github/workflows/container-dev.yml | 2 +- .github/workflows/container-release.yml | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/container-dev.yml b/.github/workflows/container-dev.yml index 9f66770f..fd73487c 100644 --- a/.github/workflows/container-dev.yml +++ b/.github/workflows/container-dev.yml @@ -1,4 +1,4 @@ -name: Development Watcharr Container Release +name: Development Watcharr Image Release on: workflow_dispatch: diff --git a/.github/workflows/container-release.yml b/.github/workflows/container-release.yml index 0c7f2215..784eaa50 100644 --- a/.github/workflows/container-release.yml +++ b/.github/workflows/container-release.yml @@ -1,7 +1,6 @@ -name: Release Watcharr Containers +name: Release Watcharr Image on: - workflow_dispatch: push: tags: - v*