diff --git a/docker/Dockerfile b/docker/Dockerfile index 8571861..0a66e83 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,6 +1,11 @@ FROM node:18-alpine as builder WORKDIR /app COPY package*.json ./ +ENV NODE_ENV=production +ENV BASE_PATH=/containers/matheothierry-portfolio_nuxt +ENV CDN_URL=https://codefirst.iut.uca.fr +ENV HOST=0.0.0.0 +ENV PORT=3000 RUN npm install COPY . . RUN npm run build @@ -14,6 +19,7 @@ COPY --from=builder /app/.nuxt ./.nuxt RUN npm install --production ENV NODE_ENV=production ENV BASE_PATH=/containers/matheothierry-portfolio_nuxt +ENV CDN_URL=https://codefirst.iut.uca.fr ENV HOST=0.0.0.0 ENV PORT=3000 diff --git a/nuxt.config.ts b/nuxt.config.ts index 350ebbd..687844b 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -29,16 +29,17 @@ export default defineNuxtConfig({ } ], }, - baseURL:'/containers/matheothierry-portfolio_nuxt/', + baseURL: process.env.NODE_ENV === 'production' ? process.env.BASE_PATH : '/', buildAssetsDir: '/_nuxt/', - cdnURL: 'https://codefirst.iut.uca.fr/' + cdnURL: process.env.NODE_ENV === 'production' ? process.env.CDN_URL : '', }, modules: ['@nuxt/image'], plugins: [ { src: 'plugins/router.ts', mode: 'server' }, - { src: 'plugins/theme.ts', mode: 'client' } + { src: 'plugins/theme.ts', mode: 'client' }, + { src: 'plugins/prevent-redirection.client.ts', mode: 'server' } ], image: { @@ -64,7 +65,7 @@ export default defineNuxtConfig({ runtimeConfig: { public: { - basePath: process.env.NODE_ENV === 'production' ? '/containers/matheothierry-portfolio_nuxt/' : '/' + basePath: process.env.NODE_ENV === 'production' ? process.env.BASE_PATH : '/' } } -}) +}) \ No newline at end of file diff --git a/plugins/prevent-redirection.client.ts b/plugins/prevent-redirection.client.ts new file mode 100644 index 0000000..47d10a7 --- /dev/null +++ b/plugins/prevent-redirection.client.ts @@ -0,0 +1,6 @@ +export default defineNuxtPlugin({ + order: -40, + setup: (nuxtApp) => { + delete nuxtApp.payload.path + } +}) \ No newline at end of file