Change strategy, only build docker image

I couldnt' get the local build to run with the alternative
`nuxt.config.js`. So I'm building docker only now.
This commit is contained in:
roschaefer 2019-09-09 22:46:41 +02:00 committed by mattwr18
parent 61e583e31b
commit d6b7374ddb
11 changed files with 8055 additions and 31 deletions

View File

@ -16,3 +16,5 @@ README.md
screenshot*.png screenshot*.png
lokalise.png lokalise.png
.editorconfig .editorconfig
maintenance/node_modules/

View File

@ -0,0 +1,41 @@
FROM node:12.10.0-alpine as build
LABEL Description="Web Frontend of the Social Network Human-Connection.org" Vendor="Human-Connection gGmbH" Version="0.0.1" Maintainer="Human-Connection gGmbH (developer@human-connection.org)"
EXPOSE 3000
CMD ["yarn", "run", "start"]
# Expose the app port
ARG BUILD_COMMIT
ENV BUILD_COMMIT=$BUILD_COMMIT
ARG WORKDIR=/nitro-web
RUN mkdir -p $WORKDIR
WORKDIR $WORKDIR
# See: https://github.com/nodejs/docker-node/pull/367#issuecomment-430807898
RUN apk --no-cache add git
COPY maintenance/source/package.json ./package.json
COPY maintenance/source/yarn.lock ./yarn.lock
RUN yarn install --production=false --frozen-lockfile --non-interactive
COPY assets assets
COPY components/LocaleSwitch/ components/LocaleSwitch
COPY components/Dropdown.vue components/Dropdown.vue
COPY layouts/blank.vue layouts/blank.vue
COPY locales locales
COPY mixins mixins
COPY plugins/i18n.js plugins/i18n.js
COPY plugins/v-tooltip.js plugins/v-tooltip.js
COPY plugins/styleguide.js plugins/styleguide.js
COPY static static
COPY nuxt.config.js nuxt.config.js
COPY maintenance/source ./
RUN yarn run generate
FROM nginx:alpine
COPY --from=build ./nitro-web/dist/ /usr/share/nginx/html/
RUN rm /etc/nginx/conf.d/default.conf
COPY maintenance/nginx/custom.conf /etc/nginx/conf.d/

View File

@ -0,0 +1,23 @@
server {
listen 80;
server_name localhost;
root /usr/share/nginx/html;
index index.html;
# location / {
# try_files $uri $uri/ /index.html;
# }
location ~* \.(?:css|js|map|jpe?g|gif|png|svg|woff|ico)$ { }
location / {
if (-f $document_root/index.html) {
return 503;
}
}
error_page 503 @maintenance;
location @maintenance {
rewrite ^(.*)$ /index.html break;
}
}

View File

@ -1,7 +1,20 @@
import defaultNuxtConfig, { envWhitelist } from './nuxt.config.js' import defaultConfig from './nuxt.config.js'
const {
css,
styleResources,
env: {
locales,
},
manifest,
} = defaultConfig
export default { export default {
...defaultNuxtConfig, css,
styleResources,
env: { locales },
manifest,
head: { head: {
title: 'Human Connection', title: 'Human Connection',
meta: [ meta: [
@ -26,45 +39,25 @@ export default {
}, },
], ],
}, },
env: {
...defaultNuxtConfig.env,
maintenance: true,
},
/*
** Plugins to load before mounting the App
*/
plugins: [ plugins: [
{ src: `~/plugins/styleguide.js`, ssr: true }, { src: `~/plugins/styleguide.js`, ssr: true },
{ src: '~/plugins/i18n.js', ssr: true }, { src: '~/plugins/i18n.js', ssr: true },
{ src: '~/plugins/v-tooltip.js', ssr: false }, { src: '~/plugins/v-tooltip.js', ssr: false },
], ],
/*
** Nuxt.js modules
*/
modules: [ modules: [
[
'nuxt-env',
{
keys: envWhitelist,
},
],
'cookie-universal-nuxt', 'cookie-universal-nuxt',
'@nuxtjs/style-resources', '@nuxtjs/style-resources',
'@nuxtjs/sentry',
], ],
router: { router: {
middleware: ['maintenance'], extendRoutes(routes, resolve) {
extendRoutes (routes, resolve) {
routes.push({ routes.push({
name: 'maintenance', name: 'maintenance',
path: '*', path: '*',
component: resolve(__dirname, 'maintenance/maintenance.vue'), component: resolve(__dirname, 'pages/index.vue')
}) })
} }
}, }
} }

View File

@ -0,0 +1,26 @@
{
"name": "@human-connection/maintenance",
"version": "1.0.0",
"description": "Maintenance page for Human Connection",
"main": "index.js",
"repository": "https://github.com/Human-Connection/Human-Connection",
"author": "Robert Schäfer",
"license": "MIT",
"private": false,
"scripts": {
"dev": "yarn run nuxt -c nuxt.config.maintenance.js",
"build": "yarn run nuxt build -c nuxt.config.maintenance.js",
"start": "yarn run nuxt start -c nuxt.config.maintenance.js",
"generate": "yarn run nuxt generate -c nuxt.config.maintenance.js"
},
"devDependencies": {
"@human-connection/styleguide": "^0.5.21",
"@nuxtjs/style-resources": "^1.0.0",
"cookie-universal-nuxt": "^2.0.17",
"node-sass": "^4.12.0",
"nuxt": "^2.9.2",
"sass-loader": "^8.0.0",
"v-tooltip": "^2.0.2",
"vuex-i18n": "^1.13.1"
}
}

View File

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +0,0 @@
export default async ({ redirect }) => {
return redirect('/maintenance')
}

View File

@ -7,7 +7,7 @@ import { isEmpty, find } from 'lodash'
* and implement the user preference logic * and implement the user preference logic
*/ */
export default ({ app, req, cookie, store }) => { export default ({ app, req, cookie, store }) => {
const debug = app.$env.NODE_ENV !== 'production' const debug = app.$env && app.$env.NODE_ENV !== 'production'
const key = 'locale' const key = 'locale'
const changeHandler = async mutation => { const changeHandler = async mutation => {

View File

@ -53,7 +53,6 @@ export const actions = {
if (!process.server) { if (!process.server) {
return return
} }
if (this.app.$env.maintenance) return
const token = this.app.$apolloHelpers.getToken() const token = this.app.$apolloHelpers.getToken()
if (!token) { if (!token) {
return return