Optimize Docker build and loading performance

This commit is contained in:
Felix 2020-02-15 17:36:06 +01:00
parent 37b82c8614
commit db6bbf1ffa
4 changed files with 19 additions and 7 deletions

View File

@ -29,6 +29,10 @@ server {
# Hide nginx version
server_tokens off;
gzip on;
gzip_types text/css application/javascript application/json text/vtt text/html image/svg+xml;
gzip_vary on;
# Only connect to this site via HTTPS
add_header Strict-Transport-Security "max-age=63072000";

View File

@ -3,20 +3,30 @@ FROM node:13-alpine as build-stage
WORKDIR /app
COPY package.json .
COPY yarn.lock .
RUN apk add python2 make g++
RUN yarn install --pure-lockfile \
&& yarn cache clean
COPY src/ src/
COPY public/ public/
COPY yarn.lock .
COPY .eslintrc.js .
COPY vue.config.js .
COPY Makefile .
COPY .babelrc .
# TODO: the build works fine with only the above files, does that mean we can delete everything else?
#COPY babel.config.js .
#COPY vue.config.js .
#COPY postcss.config.js .
#COPY .eslintrc .
ENV NODE_ENV=production
RUN yarn run build
FROM nginx as production-stage

View File

@ -21,17 +21,15 @@ http {
# Hide nginx version
server_tokens off;
# TODO: this is not really working
gzip on;
gzip_types text/css application/javascript application/json text/vtt text/html image/svg+xml;
gzip_vary on;
# TODO: maybe setup cache as well
location / {
root /app;
index index.html;
try_files $uri $uri/ /index.html;
expires 1d;
add_header Pragma public;
add_header Cache-Control "public";
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {

View File

@ -305,7 +305,7 @@
const currentLanguage = this.$language.current.split('_')[0]
const params = '?subtitle=' + currentLanguage
return 'https://framatube.org/videos/embed/9c9de5e8-0a1e-484a-b099-e80766180a6d' + params
return 'https://peertube.social/videos/embed/9c9de5e8-0a1e-484a-b099-e80766180a6d' + params
}
},
components: {