Skip to content

Commit

Permalink
add docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
baloola committed Dec 13, 2023
1 parent c21a26c commit fdccbb9
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
FROM node:lts-alpine3.18 AS build-step

WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
RUN npm run generate


FROM nginx:1-alpine-slim

COPY --from=build-step /app/.output/public /usr/share/nginx/html

# change default port to 8080
RUN apk add jq pcre-tools && \
sed -i 's/\s*listen\s*80;/ listen 8080;/' /etc/nginx/conf.d/default.conf && \
sed -i 's/\s*location \/ {/ location \/ {\n try_files $uri $uri\/ \/index.html;/' /etc/nginx/conf.d/default.conf && \
sed -i '/location \//a\
add_header \"Access-Control-Allow-Origin\" \"*\";\n add_header \"Access-Control-Allow-Methods\" \"GET, POST, PUT, DELETE, OPTIONS\"; \
add_header \"Access-Control-Allow-Headers\" \"Content-Type, Authorization\";' /etc/nginx/conf.d/default.conf


EXPOSE 8080

STOPSIGNAL SIGTERM


0 comments on commit fdccbb9

Please sign in to comment.