feat: add new dockerfile
This commit is contained in:
parent
5303bb895d
commit
ab5bd5fe2b
|
@ -0,0 +1,3 @@
|
||||||
|
node_modules/
|
||||||
|
.next
|
||||||
|
.idea
|
27
Dockerfile
27
Dockerfile
|
@ -1,8 +1,23 @@
|
||||||
FROM node:bookworm AS build
|
FROM node:20.10.0 as dependencies
|
||||||
RUN node -v
|
WORKDIR /app
|
||||||
|
COPY package.json package-lock.json ./
|
||||||
|
RUN npm ci --verbose
|
||||||
|
|
||||||
|
FROM node:20.10.0 as builder
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY . .
|
COPY . .
|
||||||
FROM nginx
|
COPY --from=dependencies /app/node_modules ./node_modules
|
||||||
COPY --from=build /app/dist /usr/share/nginx/html/
|
RUN npm run build --debug --verbose
|
||||||
RUN rm /etc/nginx/conf.d/default.conf
|
|
||||||
COPY _nginx/nginx.conf /etc/nginx/conf.d
|
FROM node:20.10.0 as runner
|
||||||
|
WORKDIR /app
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
ENV NODE_ENV production
|
||||||
|
COPY --from=builder /app/public ./public
|
||||||
|
COPY --from=builder /app/package.json ./package.json
|
||||||
|
COPY --from=builder /app/.next ./.next
|
||||||
|
COPY --from=dependencies /app/node_modules ./node_modules
|
||||||
|
|
||||||
|
EXPOSE 4200
|
||||||
|
CMD ["npm", "start"]
|
||||||
|
|
|
@ -28,8 +28,6 @@ const nextConfig = {
|
||||||
taint: true,
|
taint: true,
|
||||||
// typedRoutes: true
|
// typedRoutes: true
|
||||||
},
|
},
|
||||||
output: 'export',
|
|
||||||
distDir: 'dist',
|
|
||||||
poweredByHeader: false,
|
poweredByHeader: false,
|
||||||
productionBrowserSourceMaps: true,
|
productionBrowserSourceMaps: true,
|
||||||
trailingSlash: true
|
trailingSlash: true
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "next dev -p 4200",
|
"dev": "next dev -p 4200",
|
||||||
"build": "next build",
|
"build": "next build",
|
||||||
"start": "next start",
|
"start": "next start -p 4200",
|
||||||
"lint": "next lint"
|
"lint": "next lint"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
'use client';
|
||||||
|
|
||||||
|
import { redirect } from 'next/navigation';
|
||||||
|
import { useLocalStorage } from '../../../../../hooks/useLocalStorage';
|
||||||
|
import { AUTH_TOKEN_KEY } from '../../../../../constants/common';
|
||||||
|
import { SessionType } from '../../../../../types/sessions';
|
||||||
|
|
||||||
|
export default function SessionsMainPage() {
|
||||||
|
const [token] = useLocalStorage(AUTH_TOKEN_KEY, '');
|
||||||
|
|
||||||
|
return token ? redirect(SessionType.UPCOMING) : null;
|
||||||
|
};
|
|
@ -1,6 +1,5 @@
|
||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import React from 'react';
|
|
||||||
import { redirect } from 'next/navigation';
|
import { redirect } from 'next/navigation';
|
||||||
import { useLocalStorage } from '../../../hooks/useLocalStorage';
|
import { useLocalStorage } from '../../../hooks/useLocalStorage';
|
||||||
import { AUTH_TOKEN_KEY } from '../../../constants/common';
|
import { AUTH_TOKEN_KEY } from '../../../constants/common';
|
||||||
|
|
Loading…
Reference in New Issue