-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
40 lines (27 loc) · 946 Bytes
/
Dockerfile
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
36
37
38
39
40
# Use an official Node.js runtime as a parent image
FROM node:hydrogen AS build
# Set the working directory
WORKDIR /usr/app
# Copy package.json and package-lock.json
COPY package*.json ./
# Install dependencies
RUN npm install
# Copy the rest of the application code
COPY . .
# Build the application
RUN npm run build
# Use a lightweight web server to serve the application
FROM nginx:alpine
# Copy the build output to the Nginx html directory
COPY --from=build /usr/app/dist /usr/share/nginx/html
# Copy the custom Nginx configuration file
COPY nginx.conf /etc/nginx/conf.d/default.conf
RUN chgrp -R 0 /usr/share/nginx/html /etc/nginx/nginx.conf /var/cache/nginx && \
chmod -R g=u /usr/share/nginx/html /etc/nginx/nginx.conf /var/cache/nginx
# Add S2I scripts
COPY .s2i/bin/ /usr/libexec/s2i/
# Set permissions for S2I scripts
RUN chmod +x /usr/libexec/s2i/assemble /usr/libexec/s2i/run
USER 1001
# Expose port 8080
EXPOSE 8080