Skip to content

Commit d8fabcc

Browse files
0.1.0 development
1 parent 497a406 commit d8fabcc

File tree

4 files changed

+154
-0
lines changed

4 files changed

+154
-0
lines changed

.devcontainer/Dockerfile

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
2+
FROM mcr.microsoft.com/devcontainers/base:ubuntu
3+
4+
ENV DEBIAN_FRONTEND=noninteractive
5+
ENV SHELL=/usr/bin/zsh
6+
ENV HUGO_VERSION 0.144.2
7+
8+
RUN apt-get update -y && apt-get install -y \
9+
wget git curl build-essential ca-certificates \
10+
&& apt-get autoremove -y \
11+
&& apt-get clean -y \
12+
&& rm -rf /var/lib/apt/lists/*
13+
14+
# Download and install Hugo
15+
RUN wget https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_${HUGO_VERSION}_Linux-64bit.deb && \
16+
dpkg -i hugo_${HUGO_VERSION}_Linux-64bit.deb && \
17+
rm hugo_${HUGO_VERSION}_Linux-64bit.deb
18+
19+
# Set the working directory
20+
#WORKDIR /site
21+
22+
# Copy the site files
23+
#COPY . /site
24+
25+
# Build the Hugo site
26+
RUN hugo
27+
28+
# Expose the port Hugo server runs on
29+
EXPOSE 1313
30+
31+
# Start the Hugo server
32+
CMD ["hugo", "server", "--bind", "0.0.0.0"]

.devcontainer/devcontainer.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"name": "Hugo Dev Container",
3+
"build": {
4+
"dockerfile": "Dockerfile"
5+
},
6+
"customizations": {
7+
"vscode": {
8+
"settings": {
9+
"terminal.integrated.defaultProfile.linux": "zsh"
10+
}
11+
},
12+
"extensions": [
13+
"ms-azuretools.vscode-docker",
14+
"vscode.git",
15+
"golang.go"
16+
]
17+
},
18+
"postCreateCommand": "hugo new site ."
19+
}

.github/workflows/hugo.yml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# Sample workflow for building and deploying a Hugo site to GitHub Pages
2+
name: Deploy Hugo site to Pages
3+
4+
on:
5+
# Runs on pushes targeting the default branch
6+
push:
7+
branches:
8+
- main
9+
10+
# Allows you to run this workflow manually from the Actions tab
11+
workflow_dispatch:
12+
13+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
14+
permissions:
15+
contents: read
16+
pages: write
17+
id-token: write
18+
19+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
20+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
21+
concurrency:
22+
group: "pages"
23+
cancel-in-progress: false
24+
25+
# Default to bash
26+
defaults:
27+
run:
28+
shell: bash
29+
30+
jobs:
31+
# Build job
32+
build:
33+
runs-on: ubuntu-latest
34+
env:
35+
HUGO_VERSION: 0.144.2
36+
steps:
37+
- name: Install Hugo CLI
38+
run: |
39+
wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \
40+
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb
41+
- name: Install Dart Sass
42+
run: sudo snap install dart-sass
43+
- name: Checkout
44+
uses: actions/checkout@v4
45+
with:
46+
submodules: recursive
47+
fetch-depth: 0
48+
- name: Setup Pages
49+
id: pages
50+
uses: actions/configure-pages@v5
51+
- name: Install Node.js dependencies
52+
run: "[[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci || true"
53+
- name: Build with Hugo
54+
env:
55+
HUGO_CACHEDIR: ${{ runner.temp }}/hugo_cache
56+
HUGO_ENVIRONMENT: production
57+
TZ: America/Los_Angeles
58+
run: |
59+
hugo \
60+
--gc \
61+
--minify \
62+
--baseURL "${{ steps.pages.outputs.base_url }}/"
63+
- name: Upload artifact
64+
uses: actions/upload-pages-artifact@v3
65+
with:
66+
path: ./public
67+
68+
# Deployment job
69+
deploy:
70+
environment:
71+
name: github-pages
72+
url: ${{ steps.deployment.outputs.page_url }}
73+
runs-on: ubuntu-latest
74+
needs: build
75+
steps:
76+
- name: Deploy to GitHub Pages
77+
id: deployment
78+
uses: actions/deploy-pages@v4

Dockerfile

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Local development environment for Hugo
2+
FROM ubuntu:latest
3+
4+
ENV DEBIAN_FRONTEND=noninteractive
5+
ENV HUGO_VERSION=0.145.0
6+
7+
RUN apt-get update -y && apt-get install -y \
8+
wget \
9+
&& apt-get autoremove -y \
10+
&& apt-get clean -y \
11+
&& rm -rf /var/lib/apt/lists/*
12+
13+
RUN wget https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb && \
14+
dpkg -i hugo_extended_${HUGO_VERSION}_linux-amd64.deb && \
15+
rm hugo_extended_${HUGO_VERSION}_linux-amd64.deb
16+
17+
WORKDIR /site
18+
19+
COPY . /site
20+
21+
RUN hugo
22+
23+
EXPOSE 1313
24+
25+
CMD ["hugo", "server", "--bind", "0.0.0.0"]

0 commit comments

Comments
 (0)