fix: prevent nginx default page in hugo image
Some checks failed
Deploy Hugo Blog to k3s / build-and-deploy (push) Failing after 24s
Some checks failed
Deploy Hugo Blog to k3s / build-and-deploy (push) Failing after 24s
This commit is contained in:
@@ -25,6 +25,8 @@ jobs:
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Setup Hugo
|
||||
run: |
|
||||
@@ -63,7 +65,16 @@ jobs:
|
||||
hugo version
|
||||
|
||||
- name: Hugo Build
|
||||
run: hugo --minify
|
||||
run: |
|
||||
set -euo pipefail
|
||||
rm -rf public
|
||||
hugo --minify
|
||||
test -s public/index.html
|
||||
if grep -q "Welcome to nginx" public/index.html; then
|
||||
echo "public/index.html is nginx default page, aborting" >&2
|
||||
exit 1
|
||||
fi
|
||||
grep -q "洛尘的技术笔记" public/index.html
|
||||
|
||||
- name: Build and Push Docker Image
|
||||
env:
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
FROM docker.m.daocloud.io/library/nginx:alpine
|
||||
COPY public/ /usr/share/nginx/html
|
||||
RUN rm -rf /usr/share/nginx/html/*
|
||||
COPY public/ /usr/share/nginx/html/
|
||||
RUN test -s /usr/share/nginx/html/index.html \
|
||||
&& ! grep -q "Welcome to nginx" /usr/share/nginx/html/index.html
|
||||
EXPOSE 80
|
||||
|
||||
Reference in New Issue
Block a user