docker deployment
This commit is contained in:
parent
99d5e7b464
commit
7e4af7480b
21
Dockerfile
Normal file
21
Dockerfile
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
# Stage 1: Build the Hugo site
|
||||||
|
FROM hugomods/hugo:exts-0.145.0 AS builder
|
||||||
|
|
||||||
|
WORKDIR /src
|
||||||
|
COPY . /src
|
||||||
|
|
||||||
|
RUN npm install --prefix /src
|
||||||
|
|
||||||
|
# Fetch modules (if using Hugo modules) and build the site
|
||||||
|
RUN hugo mod get -u && hugo --minify
|
||||||
|
|
||||||
|
# Stage 2: Serve with Nginx
|
||||||
|
FROM nginx:alpine
|
||||||
|
|
||||||
|
# Copy the built site from the builder stage
|
||||||
|
COPY --from=builder /src/public /usr/share/nginx/html
|
||||||
|
|
||||||
|
# Expose port 80
|
||||||
|
EXPOSE 80
|
||||||
|
|
||||||
|
# Default Nginx command is fine, no need to override
|
14
docker-compose.yml
Normal file
14
docker-compose.yml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
version: '3.8'
|
||||||
|
services:
|
||||||
|
web:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
image: my-hugo-app:production
|
||||||
|
ports:
|
||||||
|
- "80:80"
|
||||||
|
restart: unless-stopped
|
||||||
|
environment:
|
||||||
|
- NGINX_PORT=80
|
||||||
|
volumes:
|
||||||
|
- ./public:/usr/share/nginx/html:ro # Optional, for debugging
|
Loading…
x
Reference in New Issue
Block a user