diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..944a2ec --- /dev/null +++ b/.dockerignore @@ -0,0 +1,4 @@ +node_modules +.next +.git +.env* diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..a329877 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,24 @@ +FROM node:18-alpine AS deps +WORKDIR /app +COPY package.json package-lock.json ./ +RUN npm ci + +FROM node:18-alpine AS builder +WORKDIR /app +COPY --from=deps /app/node_modules ./node_modules +COPY . . +ENV NEXT_TELEMETRY_DISABLED=1 +RUN npm run build + +FROM node:18-alpine AS runner +WORKDIR /app +ENV NODE_ENV=production +ENV NEXT_TELEMETRY_DISABLED=1 +RUN addgroup --system --gid 1001 nodejs && adduser --system --uid 1001 nextjs +COPY --from=builder /app/public ./public +COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./ +COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static +USER nextjs +EXPOSE 3000 +ENV PORT=3000 +CMD ["node", "server.js"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..a45f102 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,18 @@ +services: + draw-fast: + build: . + container_name: draw-fast + restart: unless-stopped + environment: + - FAL_KEY=${FAL_KEY} + labels: + - "traefik.enable=true" + - "traefik.http.routers.draw-fast.rule=Host(`draw.jeffemmett.com`)" + - "traefik.http.routers.draw-fast.entrypoints=web" + - "traefik.http.services.draw-fast.loadbalancer.server.port=3000" + networks: + - traefik + +networks: + traefik: + external: true diff --git a/next.config.js b/next.config.js index 658404a..b408897 100644 --- a/next.config.js +++ b/next.config.js @@ -1,4 +1,6 @@ /** @type {import('next').NextConfig} */ -const nextConfig = {}; +const nextConfig = { + output: 'standalone', +}; module.exports = nextConfig;