21 lines
580 B
Docker
21 lines
580 B
Docker
|
|
# Build preperation
|
||
|
|
FROM node:lts AS deps
|
||
|
|
COPY package*.json ./
|
||
|
|
RUN npm version --allow-same-version 1.0.0
|
||
|
|
|
||
|
|
# Build frontend application
|
||
|
|
FROM node:lts AS builder
|
||
|
|
WORKDIR /build
|
||
|
|
COPY --from=deps package*.json ./
|
||
|
|
COPY .npmrc ./
|
||
|
|
RUN npm ci --cache .npm --prefer-offline
|
||
|
|
COPY . .
|
||
|
|
RUN npm run build
|
||
|
|
|
||
|
|
# Setup nginx server for frontend
|
||
|
|
FROM nginx:stable AS nginx
|
||
|
|
COPY --from=builder /build/dist/ /www/
|
||
|
|
COPY docker/default.conf /etc/nginx/conf.d/
|
||
|
|
EXPOSE 80
|
||
|
|
CMD ["/bin/bash", "-c", "sed -i 's@<html@<html data-api-base-url=\"'$API_BASE_URL'\"@' /www/index.html; nginx -g \"daemon off;\""]
|