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
|
# build with nodejs
|
||||||
WORKDIR /usr/src/app
|
FROM node:25.8-bullseye-slim AS build
|
||||||
COPY package.json .
|
ENV NODE_ENV production
|
||||||
COPY package-lock.json* .
|
WORKDIR /app
|
||||||
RUN npm ci
|
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
|
# serve compiled files with local nginx config
|
||||||
WORKDIR /usr/src/app
|
FROM nginx:alpine
|
||||||
COPY --from=builder /usr/src/app/ /usr/src/app/
|
WORKDIR /app
|
||||||
COPY . .
|
COPY --from=build /app/public .
|
||||||
CMD ["npx", "quartz", "build", "--serve"]
|
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