docker support
This commit is contained in:
24
docker/Dockerfile
Normal file
24
docker/Dockerfile
Normal file
@ -0,0 +1,24 @@
|
||||
# Multi-stage
|
||||
# 1) Node image for building frontend assets
|
||||
# 2) nginx stage to serve frontend assets
|
||||
|
||||
# Name the node stage "builder"
|
||||
FROM node:16 AS builder
|
||||
# Set working directory
|
||||
WORKDIR /app
|
||||
# Copy all files from current directory to working dir in image
|
||||
COPY . .
|
||||
# install node modules and build assets
|
||||
RUN npm i && npm run build
|
||||
|
||||
# nginx state for serving content
|
||||
FROM nginx:alpine
|
||||
# Set working directory to nginx asset directory
|
||||
WORKDIR /usr/share/nginx/html
|
||||
# Remove default nginx static assets
|
||||
RUN rm -rf ./*
|
||||
# Copy static assets from builder stage
|
||||
COPY --from=builder /app/dist .
|
||||
# Containers run nginx with global directives and daemon off
|
||||
EXPOSE 80
|
||||
ENTRYPOINT ["nginx", "-g", "daemon off;"]
|
11
docker/docker-compose.yml
Normal file
11
docker/docker-compose.yml
Normal file
@ -0,0 +1,11 @@
|
||||
version: "3.9"
|
||||
services:
|
||||
frontend:
|
||||
build:
|
||||
context: "../"
|
||||
dockerfile: ./docker/Dockerfile
|
||||
ports:
|
||||
- "8080:80"
|
||||
environment:
|
||||
- VITE_BACKEND_URL=http://localhost:7000
|
||||
- VITE_INSTANCE_URL=http://localhost:80
|
Reference in New Issue
Block a user