refactor: address review comments

This commit is contained in:
Fernando Fernández 2021-02-20 13:28:47 +01:00
parent 406b332e98
commit 6371aad856
12 changed files with 2949 additions and 3275 deletions

View File

@ -1,98 +0,0 @@
# Dockerfile
Dockerfile
Dockerfile.dev
# Created by .ignore support plugin (hsz.mobi)
### Node template
# Logs
/logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
# nyc test coverage
.nyc_output
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# TypeScript v1 declaration files
typings/
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variables file
.env
# parcel-bundler cache (https://parceljs.org/)
.cache
# next.js build output
.next
# nuxt.js build output
.nuxt
# vuepress build output
.vuepress/dist
# Serverless directories
.serverless
# IDE / Editor
.idea
.run
.vscode
# Service worker
sw.*
# macOS
.DS_Store
# Vim swap files
*.swp
# Github & CI
.github
.devcontainer
.ci

7
.github/workflows/Dockerfile.nginx vendored Normal file
View File

@ -0,0 +1,7 @@
# This dockerfile is just for CI purposes. It needs the client
# built in the host in order to be created and deployed
FROM nginx:alpine
COPY dist/ /usr/share/nginx/html/
COPY .docker/nginx.conf /etc/nginx/conf.d/default.conf
COPY .docker/mime.types /etc/nginx/mime.types

15
.github/workflows/Dockerfile.ssr vendored Normal file
View File

@ -0,0 +1,15 @@
# This dockerfile is just for CI purposes. It needs the client
# built in the host in order to be created and deployed
FROM node:14-alpine
COPY .docker/package.json ./.docker/nuxt.config.js ./
COPY .nuxt ./.nuxt
COPY static ./static
# Install runtime dependencies
RUN yarn install --production --no-lockfile
EXPOSE 80
CMD [ "yarn", "start" ]

View File

@ -1,9 +1,6 @@
name: Build
on:
push:
branches:
- master
pull_request:
branches:
- master
@ -18,11 +15,11 @@ jobs:
- name: Checkout
uses: actions/checkout@master
with:
fetch-depth: 0
fetch-depth: 1
clean: true
ref: 'master'
- name: Setup node env
- name: Setup node environment
uses: actions/setup-node@v2.1.4
with:
node-version: 14
@ -33,7 +30,7 @@ jobs:
- name: Cache node_modules
uses: actions/cache@v2.1.4
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
@ -41,7 +38,7 @@ jobs:
${{ runner.os }}-yarn-
- name: Install dependencies
run: yarn install --froze-lockfile
run: yarn install --frozen-lockfile
- name: Build
run: yarn build
@ -54,11 +51,11 @@ jobs:
- name: Checkout
uses: actions/checkout@master
with:
fetch-depth: 0
fetch-depth: 1
clean: true
ref: 'master'
- name: Setup node env
- name: Setup node environment
uses: actions/setup-node@v2.1.4
with:
node-version: 14
@ -69,7 +66,7 @@ jobs:
- name: Cache node_modules
uses: actions/cache@v2.1.4
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
@ -77,7 +74,7 @@ jobs:
${{ runner.os }}-yarn-
- name: Install dependencies
run: yarn install --froze-lockfile
run: yarn install --frozen-lockfile
- name: Build
run: 'yarn build:static'

View File

@ -1,4 +1,4 @@
name: CodeQL
name: GitHub CodeQL
on:
push:

View File

@ -2,16 +2,47 @@ name: Docker stable release
on:
release:
types: |
released
prereleased
types:
- released
- prereleased
jobs:
ssr:
name: Build SSR docker image
name: Build SSR images
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@master
with:
fetch-depth: 1
clean: true
ref: 'master'
- name: Setup node environment
uses: actions/setup-node@v2.1.4
with:
node-version: 14
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Cache node_modules
uses: actions/cache@v2.1.4
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Build client
run: yarn build --production --standalone
- name: Configure QEMU
uses: docker/setup-qemu-action@v1
@ -24,58 +55,100 @@ jobs:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push SSR stable
if: github.event.release.released
- name: Build and push stable SSR images
if: github.event.action == 'released'
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: |
jellyfin/jellyfin-vue:stable-ssr
jellyfin/jellyfin-vue:stable-ssr-${{ env.GITHUB_REF }}
- name: Build and push SSR candidate
if: github.event.release.prereleased
uses: docker/build-push-action@v2
with:
push: true
tags: |
jellyfin/jellyfin-vue:rc-ssr
jellyfin/jellyfin-vue:rc-ssr-${{ env.GITHUB_REF }}
static:
name: Build static docker image
runs-on: ubuntu-latest
steps:
- name: Configure QEMU
uses: docker/setup-qemu-action@v1
- name: Configure Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push static stable
if: github.event.release.released
uses: docker/build-push-action@v2
with:
push: true
file: 'Dockerfile.static'
platforms: linux/amd64,linux/arm64,linux/arm,linux/arm/v6
file: '.github/workflows/Dockerfile.ssr'
tags: |
jellyfin/jellyfin-vue:stable
jellyfin/jellyfin-vue:stable-${{ env.GITHUB_REF }}
jellyfin/jellyfin-vue:stable-ssr
jellyfin/jellyfin-vue:stable-ssr.${{ github.event.release.tag_name }}
jellyfin/jellyfin-vue:latest
- name: Build and push static candidate
if: github.event.release.prereleased
- name: Build and push release candidate SSR images
if: github.event.action == 'prereleased'
uses: docker/build-push-action@v2
with:
context: .
push: true
file: 'Dockerfile.static'
platforms: linux/amd64,linux/arm64,linux/arm,linux/arm/v6
file: '.github/workflows/Dockerfile.ssr'
tags: |
jellyfin/jellyfin-vue:rc
jellyfin/jellyfin-vue:rc-ssr-${{ env.GITHUB_REF }}
jellyfin/jellyfin-vue:stable-rc-ssr
jellyfin/jellyfin-vue:stable-rc-ssr.${{ github.event.release.tag_name }}
static:
name: Build static images
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@master
with:
fetch-depth: 1
clean: true
ref: 'master'
- name: Setup node environment
uses: actions/setup-node@v2.1.4
with:
node-version: 14
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Cache node_modules
uses: actions/cache@v2.1.4
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Build client
run: 'yarn build:static'
- name: Configure QEMU
uses: docker/setup-qemu-action@v1
- name: Configure Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push stable static images
if: github.event.action == 'released'
uses: docker/build-push-action@v2
with:
context: .
push: true
platforms: linux/amd64,linux/arm64,linux/arm,linux/arm/v6
file: '.github/workflows/Dockerfile.nginx'
tags: |
jellyfin/jellyfin-vue:stable-static
jellyfin/jellyfin-vue:stable-static.${{ github.event.release.tag_name }}
- name: Build and push release candidate static images
if: github.event.action == 'prereleased'
uses: docker/build-push-action@v2
with:
context: .
push: true
platforms: linux/amd64,linux/arm64,linux/arm,linux/arm/v6
file: '.github/workflows/Dockerfile.nginx'
tags: |
jellyfin/jellyfin-vue:stable-rc-static
jellyfin/jellyfin-vue:stable-rc-static.${{ github.event.release.tag_name }}

View File

@ -4,11 +4,10 @@ on:
push:
branches:
- master
workflow_dispatch:
jobs:
ssr:
name: Build SSR docker image
name: Build SSR images
runs-on: ubuntu-latest
steps:
@ -16,6 +15,40 @@ jobs:
id: date
run: echo "::set-output name=date::$(date +'%Y-%m-%d')"
- name: Get commit hash
run: echo "SHORT_SHA=${GITHUB_SHA::8}" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@master
with:
fetch-depth: 1
clean: true
ref: 'master'
- name: Setup node environment
uses: actions/setup-node@v2.1.4
with:
node-version: 14
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Cache node_modules
uses: actions/cache@v2.1.4
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Build client
run: yarn build --production --standalone
- name: Configure QEMU
uses: docker/setup-qemu-action@v1
@ -28,40 +61,80 @@ jobs:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
- name: Build images and push
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: |
jellyfin/jellyfin-vue:unstable-ssr
jellyfin/jellyfin-vue:unstable-ssr.${{ steps.date.outputs.date }}.${{ github.sha }}
static:
name: Build static docker image
runs-on: ubuntu-latest
steps:
- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%Y-%m-%d')"
- name: Configure QEMU
uses: docker/setup-qemu-action@v1
- name: Configure Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v2
with:
push: true
file: 'Dockerfile.static'
platforms: linux/amd64,linux/arm64,linux/arm,linux/arm/v6
file: '.github/workflows/Dockerfile.ssr'
tags: |
jellyfin/jellyfin-vue:unstable
jellyfin/jellyfin-vue:unstable.${{ steps.date.outputs.date }}.${{ github.sha }}
jellyfin/jellyfin-vue:unstable-ssr
jellyfin/jellyfin-vue:unstable-ssr.${{ steps.date.outputs.date }}.${{ env.SHORT_SHA }}
static:
name: Build static images
runs-on: ubuntu-latest
steps:
- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%Y-%m-%d')"
- name: Get commit hash
run: echo "SHORT_SHA=${GITHUB_SHA::8}" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@master
with:
fetch-depth: 1
clean: true
ref: 'master'
- name: Setup node environment
uses: actions/setup-node@v2.1.4
with:
node-version: 14
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Cache node_modules
uses: actions/cache@v2.1.4
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Build client
run: 'yarn build:static'
- name: Configure QEMU
uses: docker/setup-qemu-action@v1
- name: Configure Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build images and push
uses: docker/build-push-action@v2
with:
context: .
push: true
platforms: linux/amd64,linux/arm64,linux/arm,linux/arm/v6
file: '.github/workflows/Dockerfile.nginx'
tags: |
jellyfin/jellyfin-vue:unstable-static
jellyfin/jellyfin-vue:unstable-static.${{ steps.date.outputs.date }}.${{ env.SHORT_SHA }}

View File

@ -18,11 +18,11 @@ jobs:
- name: Checkout
uses: actions/checkout@master
with:
fetch-depth: 0
fetch-depth: 1
clean: true
ref: 'master'
- name: Setup node env
- name: Setup node environment
uses: actions/setup-node@v2.1.4
with:
node-version: 14
@ -33,7 +33,7 @@ jobs:
- name: Cache node_modules
uses: actions/cache@v2.1.4
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
@ -41,7 +41,7 @@ jobs:
${{ runner.os }}-yarn-
- name: Install dependencies
run: yarn install --froze-lockfile
run: yarn install --frozen-lockfile
- name: Run linter
run: yarn lint
@ -54,31 +54,31 @@ jobs:
- name: Checkout
uses: actions/checkout@master
with:
fetch-depth: 0
fetch-depth: 1
clean: true
ref: 'master'
- name: Setup node env
- name: Setup node environment
uses: actions/setup-node@v2.1.4
with:
node-version: 14
- name: Install dependencies
run: yarn install --froze-lockfile
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Cache node_modules
uses: actions/cache@v2.1.4
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Run tests
run: yarn test

5
.yarnrc Normal file
View File

@ -0,0 +1,5 @@
enableTelemetry false
httpRetry 20
network-timeout 600000
registry "https://registry.npmjs.org/"
npmRegistryServer "https://registry.npmjs.org/"

View File

@ -1,4 +1,6 @@
FROM node:lts-alpine AS build
## This dockerfile builds the client entirely in a Docker context
FROM node:14-alpine AS build
WORKDIR /app
@ -7,6 +9,7 @@ RUN apk add --no-cache --virtual .build-deps git python make automake autoconf g
COPY . .
# Install dependencies
RUN yarn install --frozen-lockfile
# Build SSR app for production in standalone mode
@ -14,7 +17,7 @@ RUN yarn install --frozen-lockfile
RUN yarn build --production --standalone
# Build final image
FROM node:lts-alpine
FROM node:14-alpine
WORKDIR /app
@ -25,7 +28,7 @@ COPY --from=build /app/.nuxt ./.nuxt
COPY --from=build /app/static ./static
# Install runtime dependencies
RUN yarn install --production --forzen-lockfile
RUN yarn install --production --no-lockfile
EXPOSE 80

View File

@ -1,4 +1,6 @@
FROM node:lts-alpine AS build
## This dockerfile builds the client entirely in a Docker context
FROM node:14-alpine AS build
# Install build dependencies for node modules
RUN apk add --no-cache --virtual .build-deps git python make automake autoconf g++ libpng-dev libtool nasm file

5735
yarn.lock

File diff suppressed because it is too large Load Diff