feat: add Dockerfile and custom nginx configuration

This commit is contained in:
Stefan Imhoff
2024-04-04 12:46:30 +02:00
parent fc60b28ac1
commit 5aeb8632f7
4 changed files with 181 additions and 31 deletions

30
Dockerfile Normal file
View File

@@ -0,0 +1,30 @@
# Stage 1: Build the application
FROM --platform=linux/amd64 node:lts AS builder
RUN npm install -g pnpm
WORKDIR /app
COPY package*.json pnpm-*.yaml ./
RUN pnpm install
COPY . .
RUN pnpm run build
# Stage 2: Serve the application using Nginx
FROM nginx:stable-alpine
# Remove the default nginx.conf
RUN rm /etc/nginx/conf.d/default.conf
# Copy custom nginx configuration
COPY ./nginx.conf /etc/nginx/conf.d/default.conf
# Copy build artifacts from the builder stage
COPY --from=builder /app/dist /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]