-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile_TreeNotesUI.Old
More file actions
35 lines (24 loc) · 1.1 KB
/
Dockerfile_TreeNotesUI.Old
File metadata and controls
35 lines (24 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# Stage 1: Build the React application
FROM node:20-alpine AS build
# Declare build argument for the service URL
ENV TREE_NOTES_SERVICE_URL=http://localhost:5100
# Set the working directory inside the container
WORKDIR /app
# Copy package.json and package-lock.json to leverage Docker cache
COPY Src/01.Presentation/TreeNotes.UI/package.json Src/01.Presentation/TreeNotes.UI/package-lock.json ./
# Install dependencies
RUN npm ci
# Copy the rest of the application source code
COPY Src/01.Presentation/TreeNotes.UI/ ./
# Build the application for production, passing the build argument as an environment variable
RUN npm run build
# Stage 2: Serve the application with Nginx
FROM nginx:alpine AS final
# Copy the build output from the build stage to Nginx's default serving directory
COPY --from=build /app/dist /usr/share/nginx/html
# Copy the custom Nginx configuration template
COPY --from=build /app/nginx/default.conf.template /etc/nginx/templates/default.conf.template
COPY Src/01.Presentation/TreeNotes.UI/Docker/entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
EXPOSE 80
ENTRYPOINT ["/entrypoint.sh"]