Skip to content

Commit

Permalink
chore: Node 18, Nuxt 2.17, npm, update deps
Browse files Browse the repository at this point in the history
  • Loading branch information
kernoeb committed Oct 18, 2023
1 parent bce33c4 commit eb86fad
Show file tree
Hide file tree
Showing 11 changed files with 157 additions and 15,204 deletions.
7 changes: 7 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/node_modules
/dist
/.nuxt
/doc-dist
/nuxt-dist
/data
/types
64 changes: 29 additions & 35 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,47 +9,33 @@ on:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps:
- run: echo $GITHUB_REF
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

- uses: c-hive/gha-yarn-cache@v2

- run: yarn
- run: yarn run lint
- run: NO_UI=true docker-compose up -d
- name: Wait for containers
uses: jakejarvis/wait-action@master
with:
time: '15s'
- run: docker ps
- run: yarn test
- run: docker-compose stop
# no need to work on a cache here, it is not faster than pulling
# instead work on moving to some images hosted on ghcr.io, it is the fastest
- name: Run test dependencies
run: |
docker compose pull --quiet
NO_UI=true docker compose up -d --wait
- name: Docker meta
- name: Prepare docker image tags
id: docker_meta
uses: crazy-max/ghaction-docker-meta@v1
uses: docker/metadata-action@v4
with:
images: ghcr.io/${{ github.repository }}
tag-semver: |
{{version}}
{{major}}.{{minor}}
{{major}}
images: ghcr.io/${{ github.repository }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v2
with:
driver-opts: network=host

- name: Login to Github container registry
uses: docker/login-action@v1
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
Expand All @@ -62,21 +48,29 @@ jobs:
- name: Build and push docker images
id: docker_build
uses: docker/build-push-action@v2
uses: docker/build-push-action@v3
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.docker_meta.outputs.tags }}
platforms: linux/amd64,linux/arm64
labels: ${{ steps.docker_meta.outputs.labels }}
allow: network.host
network: host
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Stop test dependencies
run: docker compose stop

- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}

- name: Send Keel notification to staging-koumoul.com
if: startsWith(github.ref, 'refs/heads/')
run: |
curl -s --fail --show-error -X POST https://keel.admin.staging-koumoul.com/v1/webhooks/native -u ${{ secrets.KEEL_STAGING_USER }}:${{ secrets.KEEL_STAGING_PASSWORD }} -d '{"name": "ghcr.io/${{ github.repository }}", "tag": "${{ steps.docker_meta.outputs.version }}"}'
- name: Send Keel notification to koumoul.com
if: startsWith(github.ref, 'refs/tags/v')
run: |
curl -s --fail --show-error -X POST https://keel.admin.koumoul.com/v1/webhooks/native -u ${{ secrets.KEEL_PROD_USER }}:${{ secrets.KEEL_PROD_PASSWORD }} -d '{"name": "ghcr.io/${{ github.repository }}", "tag": "${{ steps.docker_meta.outputs.version }}"}'
curl -s --fail --show-error -X POST https://keel.admin.koumoul.com/v1/webhooks/native -u ${{ secrets.KEEL_PROD_USER }}:${{ secrets.KEEL_PROD_PASSWORD }} -d '{"name": "ghcr.io/${{ github.repository }}", "tag": "${{ steps.docker_meta.outputs.version }}"}'
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v16.3.0
18
768 changes: 0 additions & 768 deletions .yarn/releases/yarn-3.1.0.cjs

This file was deleted.

2 changes: 0 additions & 2 deletions .yarnrc.yml

This file was deleted.

82 changes: 62 additions & 20 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,32 +1,74 @@
FROM node:16.13.0-alpine3.13
############################################################################################################
# Stage: prepare a base image with all native utils pre-installed, used both by builder and definitive image
FROM node:18.18.2-alpine3.18 AS nativedeps
RUN apk add --no-cache curl
######################################
FROM nativedeps AS builder
MAINTAINER "contact@koumoul.com"

ENV NODE_ENV production
WORKDIR /webapp
# Installing clean-modules
RUN npm install --location=global clean-modules@3.0.4

RUN apk add --no-cache curl
WORKDIR /webapp

# Installing dependencies in webapp directory
ADD LICENSE .
ADD .yarnrc.yml .
ADD package.json .
ADD yarn.lock .
# adding yarn cache takes a bit of space but speeds up build, remove this line to inverse the trade-off
# in following versions of the stack we will use the yarn pnp option to prevent creating the node_modules directory
ADD .yarn .yarn
RUN yarn
ADD nodemon.json .
COPY LICENSE .
COPY package.json .
COPY package-lock.json .

RUN npm ci && clean-modules --yes "!**/*.eslintrc.json" "!*mocha/lib/test.js" "!**/*.mustache"

# Adding UI files
ADD public public
ADD nuxt.config.js .
ADD config config
ADD contract contract
RUN yarn run build
COPY public public
COPY nuxt.config.js .
COPY config config
COPY contract contract

# Build UI
ENV NODE_ENV production
RUN npm run build

# Adding server files
ADD server server
ADD README.md BUILD.json* ./
COPY server server

# Check quality
COPY .eslintignore .eslintignore
COPY .gitignore .gitignore
RUN npm run lint
COPY test test
RUN npm run test
RUN npm audit --omit=dev --audit-level=critical

# Cleanup /webapp/node_modules so it can be copied by next stage
RUN npm prune --production
RUN rm -rf node_modules/.cache

##################################
# Stage: main nodejs service stage
FROM nativedeps
MAINTAINER "contact@koumoul.com"

RUN apk add --no-cache dumb-init

WORKDIR /webapp

# We could copy /webapp whole, but this is better for layering / efficient cache use
COPY --from=builder /webapp/node_modules /webapp/node_modules
COPY --from=builder /webapp/package.json /webapp/package.json
COPY --from=builder /webapp/nuxt-dist /webapp/nuxt-dist
COPY nuxt.config.js nuxt.config.js
COPY server server
COPY config/default.js config/
COPY config/production.js config/
COPY config/custom-environment-variables.js config/
COPY contract contract

# Adding licence, manifests, etc.
COPY README.md BUILD.json* ./
COPY LICENSE .

# configure node webapp environment
ENV NODE_ENV production

# Default port of our webapps
EXPOSE 8080
Expand Down
8 changes: 7 additions & 1 deletion nuxt.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,13 @@ module.exports = {
buildDir: 'nuxt-dist',
build: {
publicPath: '_nuxt/',
transpile: [/@koumoul/, 'easymde', 'marked'] // Necessary for "à la carte" import of vuetify components
transpile: [ // Necessary for "à la carte" import of vuetify components
/@koumoul/,
/@data-fair/,
'easymde',
'marked',
'sanitize-html'
]
},
loading: { color: '#1e88e5' }, // Customize the progress bar color
plugins: [
Expand Down
99 changes: 50 additions & 49 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,20 @@
"name": "@data-fair/social",
"version": "1.1.0",
"description": "",
"license": "AGPL-3.0-only",
"author": "",
"main": "server",
"scripts": {
"test": "NODE_ENV=test mocha --exit --bail --timeout 20000 test/",
"analyze": "nuxt build --analyze",
"build": "nuxt build",
"dev-client": "NODE_ENV=development nuxt",
"dev-server": "DEBUG=\"upgrade*\" NODE_ENV=\"development\" nodemon server",
"lint": "eslint --ext js,vue --ignore-path .gitignore .",
"lint-fix": "eslint --ext js,vue --ignore-path .gitignore --fix .",
"dev-server": "DEBUG=\"upgrade*\" NODE_ENV=\"development\" nodemon server",
"dev-client": "NODE_ENV=development nuxt",
"build": "nuxt build",
"start": "node server",
"analyze": "nuxt build --analyze"
"test": "NODE_ENV=test mocha --exit --bail --timeout 20000 test/"
},
"author": "",
"license": "AGPL-3.0-only",
"packageManager": "yarn@3.1.0",
"eslintConfig": {
"root": true,
"env": {
"node": true
},
Expand All @@ -28,52 +26,55 @@
"plugin:vue/recommended"
],
"rules": {
"vue/no-v-html": "off",
"vue/multi-word-component-names": "off"
}
},
"devDependencies": {
"@babel/eslint-parser": "^7.16.0",
"@mdi/font": "^6.5.95",
"@nuxtjs/google-fonts": "^1.3.0",
"eslint": "^7.12.1",
"eslint-config-standard": "^16.0.3",
"eslint-plugin-import": "^2.25.2",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^5.1.1",
"eslint-plugin-vue": "^8.0.3",
"mocha": "^9.1.3"
"vue/multi-word-component-names": "off",
"vue/no-v-html": "off"
},
"root": true
},
"dependencies": {
"@data-fair/sd-express": "^1.3.1",
"@data-fair/sd-vue": "^2.6.1",
"@koumoul/nuxt-config-inject": "^0.4.10",
"@koumoul/v-iframe": "^0.9.1",
"@koumoul/vjsf": "^2.7.1",
"@data-fair/sd-express": "^1.4.3",
"@koumoul/nuxt-config-inject": "^0.4.12",
"@koumoul/vjsf": "^2.23.2",
"@nuxtjs/axios": "^5.13.6",
"@nuxtjs/i18n": "^7.1.0",
"@nuxtjs/vuetify": "^1.12.1",
"@nuxtjs/i18n": "^7.3.1",
"accept-language-parser": "^1.5.0",
"ajv": "^8.6.3",
"ajv": "^8.12.0",
"ajv-formats": "^2.1.1",
"config": "^3.3.6",
"cookie-parser": "^1.4.5",
"cookie-universal-nuxt": "^2.1.5",
"dayjs": "^1.10.7",
"easymde": "^2.16.0",
"config": "^3.3.9",
"cookie-parser": "^1.4.6",
"cookie-universal-nuxt": "^2.2.2",
"dayjs": "^1.11.10",
"event-to-promise": "^0.8.0",
"express": "^4.17.1",
"express": "^4.18.2",
"http-terminator": "^3.2.0",
"iframe-resizer": "^4.3.2",
"js-cookie": "^3.0.1",
"marked": "^4.0.10",
"mongodb": "^5.8.1",
"nodemon": "^2.0.14",
"nuxt": "^2.15.8",
"original-url": "^1.2.3",
"iframe-resizer": "^4.3.7",
"js-cookie": "^3.0.5",
"mongodb": "^5.9.0",
"nuxt-start": "^2.17.1",
"original-url": "^1.2.3"
},
"devDependencies": {
"@babel/eslint-parser": "^7.22.15",
"@data-fair/sd-vue": "^2.7.0",
"@koumoul/v-iframe": "^0.20.3",
"@mdi/font": "^6.9.96",
"@nuxtjs/google-fonts": "^2.0.0",
"@nuxtjs/vuetify": "^1.12.3",
"easymde": "^2.18.0",
"eslint": "^7.32.0",
"eslint-config-standard": "^16.0.3",
"eslint-plugin-import": "^2.28.1",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^5.2.0",
"eslint-plugin-vue": "^8.7.1",
"marked": "^4.3.0",
"mocha": "^9.2.2",
"nodemon": "^2.0.22",
"nuxt": "^2.17.1",
"reconnecting-websocket": "^4.4.0",
"sanitize-html": "^2.6.1",
"tinycolor2": "^1.4.2",
"vue": "^2.6.14"
}
"sanitize-html": "^2.11.0",
"tinycolor2": "^1.6.0",
"vue": "^2.7.14"
},
"packageManager": "yarn@3.6.4"
}
3 changes: 0 additions & 3 deletions public/pages/embed/favorites.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@
</v-container>
</template>

<i18n lang="yaml">
</i18n>

<script>
import { mapState } from 'vuex'
Expand Down
2 changes: 1 addition & 1 deletion server/nuxt.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const config = require('config')
const { Nuxt } = require('nuxt')
const { Nuxt } = require('nuxt-start')
const nuxtConfig = require('../nuxt.config.js')

module.exports = async () => {
Expand Down
Loading

0 comments on commit eb86fad

Please sign in to comment.