build: working podman deploy and build Dockerfile

This commit is contained in:
Mathew Guest 2024-07-28 11:28:08 -06:00
parent d000ccb9cd
commit 26558379be
2 changed files with 30 additions and 19 deletions

@ -1,27 +1,37 @@
FROM node:alpine As builder
# Stage 1: Build the Angular application
FROM node:alpine AS builder
WORKDIR /app
# Set the working directory
WORKDIR /
# Copy package.json and package-lock.json
COPY package.json package-lock.json ./
# Install dependencies
RUN npm install
# COPY . .
# Copy the rest of the application code
COPY . .
COPY dist dist
RUN npm run build --prod
# Build the application for production
# RUN npm run build:prod
# Stage 2: Serve the application with Nginx
FROM nginx:latest
COPY dist/angular-starter /usr/share/nginx/html
RUN mkdir /app
# Copy the built application from the builder stage to the Nginx html directory
COPY --from=builder dist/angular-starter /usr/share/nginx/html
COPY --from=builder dist/angular-starter /app
# Copy the custom Nginx configuration file
COPY config/default.conf /etc/nginx/conf.d/default.conf
# COPY --from=builder /usr/src/app/dist/angular-starter/ /usr/share/nginx/html
# COPY config/default.conf test.txt
# Expose port 80
EXPOSE 80
# Start Nginx
CMD ["nginx", "-g", "daemon off;"]

@ -3,13 +3,14 @@ server {
server_name localhost;
location / {
try_files $uri $uri/ /index.html
root /usr/share/nginx/html;
index index.html index.htm
try_files $uri $uri/ /index.html;
root /app;
index index.html;
}
error_page 500 502 503 504 /50x.html
location = {
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}