Skip to content

Commit

Permalink
refactor: divide into two stages
Browse files Browse the repository at this point in the history
  • Loading branch information
mehmetcanay committed Apr 19, 2024
1 parent e28dd94 commit d2ac471
Showing 1 changed file with 19 additions and 6 deletions.
25 changes: 19 additions & 6 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,27 @@
# FIRST STAGE
# Define the base image
FROM node:alpine
FROM node:20.12.2 as build

# Create a folder and copy the folder structure from local
# Create a folder, and copy package.json and package-lock.json to it
WORKDIR /app
COPY . /app
COPY package*.json ./

# Install dependencies
RUN npm install -g @angular/cli
RUN npm install

EXPOSE 4200
# Install Angular
RUN npm install -g @angular/cli

# Copy all the files in the current directory to the container
COPY . ./

# Build the Angular application
RUN ng build --configuration=production

# SECOND STAGE
# Define the base image
FROM nginx:latest

COPY --from=build app/dist/aftas-angular /usr/share/nginx/html

CMD ["ng", "serve", "--host", "0.0.0.0", "--port", "4200"]
EXPOSE 80

0 comments on commit d2ac471

Please sign in to comment.