Commit ae8e3e61 authored by Hervé Ménager's avatar Hervé Ménager
Browse files

enable using nuxt client as an SPA

- added spa mode in nuxt config
- created a dockerfile that serves SPA with nginx
- added that as an additional container in docker-compose
parent 37a0f1c2
FROM node:15.12.0-buster
COPY . /client
WORKDIR /client
RUN npm install yarn
RUN yarn install
RUN yarn run generate
FROM nginx:latest
COPY --from=0 /client/nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=0 /client/dist /usr/share/nginx/html
\ No newline at end of file
server {
listen 80;
listen [::]:80;
server_name localhost;
location / {
root /usr/share/nginx/html;
try_files $uri $uri/index.html index.html;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
......@@ -6,6 +6,7 @@ export default {
// Target: https://go.nuxtjs.dev/config-target
target: 'static',
mode: 'spa',
// Global page headers: https://go.nuxtjs.dev/config-head
head: {
......
This diff is collapsed.
......@@ -51,3 +51,20 @@ services:
- /client/node_modules
ports:
- '3000:3000'
front-static:
build:
context: client
# image: node:15.12.0-buster
# command: >
# bash -c "cd client &&
# yarn install &&
# yarn run generate"
# environment:
# HOST: 0.0.0.0
# NODE_ENV: development
# volumes:
# - ./client:/client
# - /client/node_modules
ports:
- '3001:80'
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment