This commit is contained in:
+11
@@ -0,0 +1,11 @@
|
||||
# Stage 1: Build the static site using Hugo
|
||||
FROM hugomods/hugo:latest AS builder
|
||||
WORKDIR /src
|
||||
COPY . .
|
||||
# Run hugo build to compile markdown into static HTML/CSS/JS in the public/ folder
|
||||
RUN hugo --minify
|
||||
|
||||
# Stage 2: Serve the compiled static site using Nginx
|
||||
FROM nginx:alpine
|
||||
COPY --from=builder /src/public /usr/share/nginx/html
|
||||
EXPOSE 80
|
||||
Vendored
+34
@@ -0,0 +1,34 @@
|
||||
pipeline {
|
||||
agent {
|
||||
node {
|
||||
label 'dongho' // Runs the deployment on the 'dongho' agent
|
||||
}
|
||||
}
|
||||
|
||||
stages {
|
||||
stage('Checkout') {
|
||||
steps {
|
||||
// Pulls the latest changes from the Git repository
|
||||
checkout scm
|
||||
|
||||
// Initialize and update Git submodules (necessary for themes like themes/paper)
|
||||
sh 'git submodule update --init --recursive'
|
||||
}
|
||||
}
|
||||
|
||||
stage('Build & Deploy') {
|
||||
steps {
|
||||
echo 'Building Docker image and starting service...'
|
||||
// Build the image and recreate container with minimal downtime
|
||||
sh 'docker compose up -d --build --remove-orphans'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
post {
|
||||
always {
|
||||
// Clean up the temporary Jenkins workspace since the files are baked into the image
|
||||
cleanWs()
|
||||
}
|
||||
}
|
||||
}
|
||||
+5
-8
@@ -1,12 +1,9 @@
|
||||
name: blog
|
||||
|
||||
services:
|
||||
hugo:
|
||||
image: hugomods/hugo:latest
|
||||
command: hugo server --bind 0.0.0.0 --baseURL http://localhost --buildDrafts --buildFuture
|
||||
volumes:
|
||||
- .:/src
|
||||
# ports:
|
||||
# - "1313:1313"
|
||||
working_dir: /src
|
||||
build: .
|
||||
image: blog-dongho:latest
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
- proxy
|
||||
@@ -22,7 +19,7 @@ services:
|
||||
- traefik.http.routers.blog-secure.rule=Host(`blog.dongho.kim`)
|
||||
- traefik.http.routers.blog-secure.tls=true
|
||||
- traefik.http.routers.blog-secure.tls.certresolver=cloudflare
|
||||
- traefik.http.services.blog-secure-service.loadbalancer.server.port=1313
|
||||
- traefik.http.services.blog-secure-service.loadbalancer.server.port=80
|
||||
|
||||
|
||||
networks:
|
||||
|
||||
Reference in New Issue
Block a user