docker compose
This commit is contained in:
parent
8cd249cd2a
commit
f0a765cdf7
3 changed files with 47 additions and 10 deletions
25
Dockerfile
25
Dockerfile
|
|
@ -1,11 +1,16 @@
|
|||
FROM node:22-slim AS builder
|
||||
WORKDIR /usr/src/app
|
||||
COPY package.json .
|
||||
COPY package-lock.json* .
|
||||
RUN npm ci
|
||||
# build with nodejs
|
||||
FROM node:25.8-bullseye-slim AS build
|
||||
ENV NODE_ENV production
|
||||
WORKDIR /app
|
||||
COPY . /app
|
||||
RUN mkdir -p dist node_modules
|
||||
RUN chown -R node:node .
|
||||
USER node
|
||||
RUN NODE_ENV=development npm i
|
||||
RUN npx quartz build
|
||||
|
||||
FROM node:22-slim
|
||||
WORKDIR /usr/src/app
|
||||
COPY --from=builder /usr/src/app/ /usr/src/app/
|
||||
COPY . .
|
||||
CMD ["npx", "quartz", "build", "--serve"]
|
||||
# serve compiled files with local nginx config
|
||||
FROM nginx:alpine
|
||||
WORKDIR /app
|
||||
COPY --from=build /app/public .
|
||||
COPY ./nginx.conf /etc/nginx/nginx.conf
|
||||
|
|
|
|||
10
docker-compose.yml
Normal file
10
docker-compose.yml
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
services:
|
||||
app:
|
||||
container_name: nginx-dauntless
|
||||
image: nginx-dauntless
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
restart: always
|
||||
ports:
|
||||
- "9929:8080"
|
||||
22
nginx.conf
Normal file
22
nginx.conf
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
http {
|
||||
include mime.types;
|
||||
sendfile on;
|
||||
|
||||
server {
|
||||
listen 8080;
|
||||
listen [::]:8080;
|
||||
|
||||
resolver 127.0.0.11;
|
||||
autoindex off;
|
||||
|
||||
server_name _;
|
||||
server_tokens off;
|
||||
|
||||
root /app;
|
||||
gzip_static on;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue