diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..1d6f427 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,27 @@ +# Build stage +FROM node:18-alpine AS builder + +WORKDIR /app + +COPY package*.json ./ +RUN npm ci + +COPY . . + +RUN npm run build + +# Production stage +FROM node:18-alpine AS runner + +WORKDIR /app + +ENV NODE_ENV=production + +# Copy built assets +COPY --from=builder /app/.next/standalone ./ +COPY --from=builder /app/.next/static ./.next/static +COPY --from=builder /app/public ./public + +EXPOSE 3000 + +CMD ["node", "server.js"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..1c8db0f --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,16 @@ +services: + betting-app: + build: . + container_name: betting-app-prod + restart: unless-stopped + labels: + - "traefik.enable=true" + - "traefik.http.routers.betting-app.rule=Host(`betting.jeffemmett.com`)" + - "traefik.http.routers.betting-app.entrypoints=web" + - "traefik.http.services.betting-app.loadbalancer.server.port=3000" + networks: + - traefik-public + +networks: + traefik-public: + external: true diff --git a/next.config.js b/next.config.js index 52f5816..68b2355 100644 --- a/next.config.js +++ b/next.config.js @@ -2,6 +2,7 @@ const nextConfig = { reactStrictMode: true, swcMinify: true, + output: 'standalone', // Environment variables that should be available on the client side env: { NEXT_PUBLIC_PUSHER_APP_KEY: process.env.NEXT_PUBLIC_PUSHER_APP_KEY,