build(dockerfile): use SSR version in dockerfile

This commit is contained in:
MrTimscampi 2021-01-19 04:34:04 +01:00
parent 6267c8451a
commit 59eef0bf61
4 changed files with 23 additions and 139 deletions

View File

@ -1,105 +0,0 @@
types {
# Data interchange
application/atom+xml atom;
application/json json map topojson;
application/ld+json jsonld;
application/rss+xml rss;
# Normalize to standard type.
# https://tools.ietf.org/html/rfc7946#section-12
application/geo+json geojson;
application/xml xml;
# Normalize to standard type.
# https://tools.ietf.org/html/rfc3870#section-2
application/rdf+xml rdf;
# JavaScript
# Servers should use text/javascript for JavaScript resources.
# https://html.spec.whatwg.org/multipage/scripting.html#scriptingLanguages
text/javascript js mjs;
application/wasm wasm;
# Manifest files
application/manifest+json webmanifest;
application/x-web-app-manifest+json webapp;
text/cache-manifest appcache;
# Media files
audio/midi mid midi kar;
audio/mp4 aac f4a f4b m4a;
audio/mpeg mp3;
audio/ogg oga ogg opus;
audio/wav wav;
audi/webm weba;
audio/x-realaudio ra;
audio/x-matroska mka;
image/bmp bmp;
image/gif gif;
image/jpeg jpeg jpg;
image/jxr jxr hdp wdp;
image/png png;
image/svg+xml svg svgz;
image/tiff tif tiff;
image/vnd.wap.wbmp wbmp;
image/webp webp;
image/x-jng jng;
video/3gpp 3gp 3gpp;
video/mp2t ts;
video/mp4 f4p f4v m4v mp4;
video/mpeg mpeg mpg;
video/ogg ogv;
video/quicktime mov;
video/webm webm;
video/x-flv flv;
video/x-mng mng;
video/x-ms-asf asf asx;
video/x-ms-wmv wmv;
video/x-msvideo avi;
video/x-matroska mkv mk3d;
# Serving `.ico` image files with a different media type
# prevents Internet Explorer from displaying then as images:
# https://github.com/h5bp/html5-boilerplate/commit/37b5fec090d00f38de64b591bcddcb205aadf8ee
image/x-icon cur ico;
# Subtitles
application/subrip sub;
text/plain txt ass ssa srt;
text/vtt vtt;
# Web fonts
font/woff woff;
font/woff2 woff2;
application/vnd.ms-fontobject eot;
font/ttf ttf;
font/collection ttc;
font/otf otf;
# Other
application/epub+zip epub;
application/gzip gz;
application/pdf pdf;
application/ttml+xml ttml;
application/x-7z-compressed 7z;
application/x-bzip bz;
application/x-bzip2 bz2:
application/x-mpegURL m3u m3u8;
application/x-rar-compressed rar;
application/zip zip;
text/css css;
text/html htm html shtml;
}

View File

@ -1,19 +0,0 @@
server {
listen 80 default_server;
root /usr/share/nginx/html;
index index.html;
gzip on;
gzip_vary on;
gzip_min_length 1024;
gzip_proxied expired no-cache no-store private auth;
gzip_types application/javascript application/json application/geo+json application/ld+json application/manifest+json application/rdf+xml application/rss+xml application/ttml+xml application/xml application/x-mpegURL text/css text/javascript text/plain text/vtt text/xml;
gzip_disable "MSIE [1-6]\.";
location / {
root /usr/share/nginx/html;
index index.html;
try_files $uri $uri/ /index.html;
}
}

View File

@ -80,6 +80,8 @@ typings/
# IDE / Editor
.idea
.run
.vscode
# Service worker
sw.*
@ -89,3 +91,8 @@ sw.*
# Vim swap files
*.swp
# Github & CI
.github
.devcontainer
.ci

View File

@ -1,25 +1,26 @@
FROM node:12-alpine AS build
FROM node:14-alpine AS build
# Install build dependencies for node modules
RUN apk add git python make g++
# Set workdir
WORKDIR /app
# Add package.json and yarn.lock
RUN apk add --no-cache --virtual .build-deps git python make automake autoconf g++ libpng-dev libtool nasm file
ADD package.json yarn.lock ./
# Install dependencies
RUN yarn install
# Copy resources
RUN apk del .build-deps
ADD . .
# Build static site
RUN yarn build
RUN yarn build:ssr
# Deploy built distribution to nginx
FROM nginx:alpine
COPY --from=build /app/dist/ /usr/share/nginx/html/
COPY .docker/nginx.conf /etc/nginx/conf.d/default.conf
COPY .docker/mime.types /etc/nginx/mime.types
# Expose the port
EXPOSE 80
# set app serving to permissive / assigned
ENV NUXT_HOST=0.0.0.0
# set app port
ENV NUXT_PORT=80
# start the client
CMD [ "yarn", "start:ssr" ]