dev: hotfix, dockerize
This commit is contained in:
6
.dockerignore
Normal file
6
.dockerignore
Normal file
@@ -0,0 +1,6 @@
|
||||
node_modules
|
||||
.git
|
||||
.gitignore
|
||||
*.md
|
||||
dist
|
||||
|
||||
37
Dockerfile
37
Dockerfile
@@ -1,17 +1,28 @@
|
||||
# Build stage
|
||||
FROM node:20-alpine AS build-stage
|
||||
# syntax = docker/dockerfile:1
|
||||
# --- Build Stage ---
|
||||
FROM node:20-alpine AS build
|
||||
WORKDIR /app
|
||||
RUN corepack enable
|
||||
|
||||
# Copy package.json and lock file, then install dependencies
|
||||
COPY package.json pnpm-lock.yaml ./
|
||||
RUN pnpm install
|
||||
|
||||
# Copy the rest of the application code and build
|
||||
COPY . .
|
||||
RUN pnpm build
|
||||
|
||||
# --- Production Stage ---
|
||||
FROM node:20-alpine AS prod
|
||||
WORKDIR /app
|
||||
|
||||
RUN corepack enable
|
||||
COPY package.json pnpm-lock.yaml ./
|
||||
RUN pnpm install --frozen-lockfile
|
||||
# Only copy the built output from the build stage
|
||||
COPY --from=build /app/.output ./
|
||||
|
||||
COPY . .
|
||||
RUN pnpm generate
|
||||
# Set environment variables for the server
|
||||
ENV PORT=3000
|
||||
ENV HOST=0.0.0.0
|
||||
EXPOSE $PORT
|
||||
|
||||
# Production stage
|
||||
FROM nginx:stable-alpine
|
||||
COPY --from=build-stage /app/.output/public /usr/share/nginx/html
|
||||
|
||||
EXPOSE 80
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
# Start the application
|
||||
CMD ["node", "server/index.mjs"]
|
||||
|
||||
17698
pnpm-lock.yaml
generated
17698
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user