This commit is contained in:
31
frontend/Dockerfile
Normal file
31
frontend/Dockerfile
Normal file
@@ -0,0 +1,31 @@
|
||||
# 1. Base image
|
||||
FROM node:20-alpine AS base
|
||||
|
||||
# 2. Install pnpm
|
||||
RUN npm install -g pnpm
|
||||
|
||||
# 3. Set working directory
|
||||
WORKDIR /app
|
||||
|
||||
# 4. Copy dependency files and install dependencies
|
||||
COPY package.json pnpm-lock.yaml ./
|
||||
RUN pnpm install --frozen-lockfile
|
||||
|
||||
# 5. Copy all source code
|
||||
COPY . .
|
||||
|
||||
# 6. Build the application
|
||||
RUN pnpm run build
|
||||
|
||||
# 7. Set up the final image
|
||||
FROM base AS final
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY --from=base /app/.svelte-kit ./.svelte-kit
|
||||
COPY --from=base /app/node_modules ./node_modules
|
||||
COPY --from=base /app/package.json ./package.json
|
||||
|
||||
# 8. Expose port and start the preview server
|
||||
EXPOSE 4173
|
||||
CMD ["pnpm", "run", "preview", "--host", "0.0.0.0", "--port", "4173"]
|
||||
Reference in New Issue
Block a user