Added initial hosting stuff

This commit is contained in:
Fergal Moran
2024-02-02 17:20:14 +00:00
parent da07d8cd3e
commit 36a00aed00
2 changed files with 39 additions and 3 deletions

8
.dockerignore Normal file
View File

@@ -0,0 +1,8 @@
Dockerfile
.dockerignore
node_modules
npm-debug.log
README.md
.next
docker
.git

View File

@@ -1,9 +1,37 @@
FROM oven/bun:alpine AS base FROM oven/bun:alpine AS base
# 1. Install dependencies only when needed #1. Install dependencies
FROM base AS deps FROM base AS deps
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
WORKDIR /app WORKDIR /app
COPY package.json bun.lockb ./ COPY package.json bun.lockb ./
RUN bun install --frozen-lockfile RUN bun install --frozen-lockfile
#2. Build the sources
FROM base AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
COPY .env .env.production
RUN bun run build
#3. Create the production image
FROM base AS runner
WORKDIR /app
ENV NODE_ENV=production
RUN addgroup -g 1001 -S nodejs
RUN adduser -S nextjs -u 1001
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
ENV HOSTNAME localhost
CMD ["node", "server.js"]