-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathDockerfile
More file actions
26 lines (26 loc) · 1.06 KB
/
Dockerfile
File metadata and controls
26 lines (26 loc) · 1.06 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
# Use the node image from official Docker Hub
FROM node:22-bookworm-slim AS build-stage
# set the working directory
WORKDIR /app
# Copy the working directory in the container
COPY package.json ./
COPY yarn.lock ./
# Install the project dependencies
RUN yarn install --frozen-lockfile
# Copy the rest of the project files to the container
COPY . .
# Build the Vue.js application to the production mode to dist folder
RUN yarn build
# Use the lightweight Nginx image from the previous stage for the nginx container
FROM nginx:stable-alpine AS production-stage
# Copy the build application from the previous stage to the Nginx container
COPY --from=build-stage /app/dist /usr/share/nginx/html/
# Copy the nginx configuration file
COPY ./nginx/nginx.conf /etc/nginx/conf.d/default.conf
# Substitute env variables at runtime
COPY ./nginx/substitute_env_variables.sh /docker-entrypoint.d/substitute_env_variables.sh
RUN chmod +x /docker-entrypoint.d/substitute_env_variables.sh
# Expose the port 8711
EXPOSE 8711
# Start Nginx to serve the application
CMD ["nginx", "-g", "daemon off;"]