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:
|
services:
|
||||||
hugo:
|
hugo:
|
||||||
image: hugomods/hugo:latest
|
build: .
|
||||||
command: hugo server --bind 0.0.0.0 --baseURL http://localhost --buildDrafts --buildFuture
|
image: blog-dongho:latest
|
||||||
volumes:
|
|
||||||
- .:/src
|
|
||||||
# ports:
|
|
||||||
# - "1313:1313"
|
|
||||||
working_dir: /src
|
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
networks:
|
networks:
|
||||||
- proxy
|
- proxy
|
||||||
@@ -22,7 +19,7 @@ services:
|
|||||||
- traefik.http.routers.blog-secure.rule=Host(`blog.dongho.kim`)
|
- traefik.http.routers.blog-secure.rule=Host(`blog.dongho.kim`)
|
||||||
- traefik.http.routers.blog-secure.tls=true
|
- traefik.http.routers.blog-secure.tls=true
|
||||||
- traefik.http.routers.blog-secure.tls.certresolver=cloudflare
|
- 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:
|
networks:
|
||||||
|
|||||||
Reference in New Issue
Block a user