Skip to content

Commit

Permalink
Merge pull request #185 from sbondCo/docker-user
Browse files Browse the repository at this point in the history
Support changing user to run docker container with & move to alpine based images
  • Loading branch information
IRHM authored Nov 2, 2023
2 parents aed9217 + d1f2255 commit 837db05
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/container-dev.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Development Watcharr Container Release
name: Development Watcharr Image Release

on:
workflow_dispatch:
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/container-release.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
name: Release Watcharr Containers
name: Release Watcharr Image

on:
workflow_dispatch:
push:
tags:
- v*
Expand Down
25 changes: 8 additions & 17 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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:19 AS ui
FROM node:20-alpine AS ui

WORKDIR /app
COPY package*.json vite.config.ts svelte.config.js tsconfig.json ./
Expand All @@ -17,24 +20,12 @@ 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-alpine 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

Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "watcharr",
"version": "1.21.0",
"version": "1.21.1-dev",
"private": true,
"scripts": {
"dev": "vite dev",
Expand Down

0 comments on commit 837db05

Please sign in to comment.