forked from shazforiot/nodeapp_test
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhorizon-dockerfile
40 lines (29 loc) · 922 Bytes
/
horizon-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
# Build project files and generate assets
FROM node:16.17-alpine AS build
# Set CI to true to catch warnings as errors
ENV CI true
# Install system dependencies
RUN apk add --no-cache \
git \
libtool \
util-linux
WORKDIR /usr/app
# Install project package dependencies
COPY package.json package-lock.json ./
RUN npm ci
# Build the project
COPY . .
#RUN npm run build
# Serving static content from build
FROM nginx:1.23.4-alpine
WORKDIR /usr/share/nginx/html
# Update system packages to resolve vulnerabilities
RUN apk update && apk upgrade --available
# Modify default behavior of web server
# to redirect requests to index.html
RUN sed -i \
's|location / {|location / {\n\t try_files $uri $uri/ /index.html;|' \
/etc/nginx/conf.d/default.conf
# Copy assets from build stage
#COPY --from=build /usr/app/build/ /usr/share/nginx/html/
HEALTHCHECK CMD curl --fail "http://localhost" || exit 1