Compare commits

..

No commits in common. "763af607c1d9a3958f7f3f3ccab6d8378df85921" and "2b95b42eb6b3322266760f789e27530ac328729e" have entirely different histories.

12 changed files with 108 additions and 83 deletions

1
.gitignore vendored
View File

@ -1,2 +1 @@
resources resources
public

View File

@ -1,2 +1,29 @@
FROM nginx FROM debian:bullseye-slim
COPY ./public /usr/share/nginx/html
ARG VERSION=0.59.1
WORKDIR /tmp
RUN apt-get update \
&& apt-get install -y tar curl ca-certificates python3 python-pip \
&& apt-get clean \
&& pip install Pygments \
&& curl https://github.com/gohugoio/hugo/releases/download/v${VERSION}/hugo_extended_${VERSION}_Linux-64bit.tar.gz -L | tar -xvz \
&& mv /tmp/hugo /usr/local/bin/hugo \
&& rm -rf /tmp/*
RUN useradd -m -u 1000 -U -p '' -s /bin/bash hugo \
&& mkdir -p /opt/workdir \
&& chown -R 1000:1000 /home/hugo /opt/workdir /usr/local/bin/hugo
USER hugo
WORKDIR /opt/workdir
VOLUME /opt/workdir
EXPOSE 1313
ENTRYPOINT /usr/local/bin/hugo
CMD ["--help"]

View File

@ -1,29 +0,0 @@
FROM debian:bullseye-slim
ARG VERSION=0.59.1
WORKDIR /tmp
RUN apt-get update \
&& apt-get install -y tar curl ca-certificates python3 python-pip \
&& apt-get clean \
&& pip install Pygments \
&& curl https://github.com/gohugoio/hugo/releases/download/v${VERSION}/hugo_extended_${VERSION}_Linux-64bit.tar.gz -L | tar -xvz \
&& mv /tmp/hugo /usr/local/bin/hugo \
&& rm -rf /tmp/*
RUN useradd -m -u 1000 -U -p '' -s /bin/bash hugo \
&& mkdir -p /opt/workdir \
&& chown -R 1000:1000 /home/hugo /opt/workdir /usr/local/bin/hugo
USER hugo
WORKDIR /opt/workdir
VOLUME /opt/workdir
EXPOSE 1313
ENTRYPOINT /usr/local/bin/hugo
CMD ["--help"]

View File

@ -12,11 +12,6 @@ h1,
h2, h2,
h3 { h3 {
font-size: 12pt; font-size: 12pt;
margin: 0 0 10px 0;
}
p {
margin: 0 0 10px 0;
} }
.container { .container {
@ -29,7 +24,6 @@ p {
} }
#header { #header {
margin-bottom: 20px;
grid-column-start: 1; grid-column-start: 1;
grid-column-end: 3; grid-column-end: 3;
} }

View File

@ -3,27 +3,18 @@
display: flex; display: flex;
list-style-type: none; list-style-type: none;
padding: 0; padding: 0;
margin: 0 0 10px 0;
li { li {
margin-right: 5px; margin-right: 5px;
//background-color: black; background-color: black;
padding: 0 5px; padding: 0 5px;
border-radius: 5px; border-radius: 5px;
a {
text-decoration: none;
&:hover {
text-decoration: underline;
text-decoration-color: #cb4b16;
}
}
} }
} }
p code { p code {
background-color: #1c1c1c; background-color: #1c1c1c;
color: #f73b3b; color: #a31515;
} }
.postdate { .postdate {

View File

@ -6,15 +6,16 @@ tags: [git, testing, bash]
[Git hooks][1] are a feature of the Git VCS that allow you to fire off custom logic on the client side when you take [Git hooks][1] are a feature of the Git VCS that allow you to fire off custom logic on the client side when you take
actions in your repository. These are shell scripts in the `.git/hooks/` directory of your repository, but they can also actions in your repository. These are shell scripts in the `.git/hooks/` directory of your repository, but they can also
exist in your home directory at `~/.githooks/`. exist at `~/.githooks/`.
Any hooks found in `~/.githooks/` are executed globally, this makes it easy to setup a custom workflow that is consistent Any hooks found in `~/.githooks/` are executed globally for the user of that shell, this makes it awesome for running a
across your entire machine. custom workflow that is consistent across your entire machine.
## Automatically lint and test on commit ## Useful hooks
My favorite hook that I'm running these days is a `~/.githooks/pre-commit` hook that auto runs tests and lint commands
if they're found.
One of my favorite hooks is the `~/.githooks/pre-commit` hook that auto runs test and lint commands from a `makefile` or
`package.json` if they're found:
```sh ```sh
{{<highlight bash "linenos=table">}} {{<highlight bash "linenos=table">}}
@ -38,10 +39,8 @@ fi
{{</highlight>}} {{</highlight>}}
``` ```
The `/usr/bin/env bash` piece ensures that the script has access to all of the environment variables you expect in your
regular shell.
If the test or lint command fails then the `git commit` command fails. If I absolutely need to commit something in spite If the test or lint command fails then the `git commit` command fails. If I absolutely need to commit something in spite
of the lint/test results I can do `git commit --no-verify` to skip the `pre-commit` hook. of the lint/test results failing I can do `git commit --no-verify` to skip the `pre-commit` hook.
[1]: https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks "Git hooks" [1]: https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks "Git hooks"

View File

@ -3,7 +3,7 @@
{{ range .Param $taxo }} {{ range .Param $taxo }}
{{ $name := . }} {{ $name := . }}
{{ with $.Site.GetPage (printf "/%s/%s" $taxo ($name | urlize)) }} {{ with $.Site.GetPage (printf "/%s/%s" $taxo ($name | urlize)) }}
<li><a href="{{ .Permalink }}">#{{ $name }}</a></li> <li><a href="{{ .Permalink }}">{{ $name }}</a></li>
{{ end }} {{ end }}
{{ end }} {{ end }}
</ul> </ul>

View File

@ -1,31 +1,16 @@
VERSION := $(shell git rev-parse --abbrev-ref HEAD) .PHONY: docker-build serve write
.PHONY: clean docker-build-dev serve write
write: serve write: serve
build: public
docker build -t vdhsn/blog:${VERSION} -f Dockerfile .
publish: build
docker push vdhsn/blog:${VERSION}
test-publish: build
docker run -it -p 8080:80 vdhsn/blog:${VERSION}
new-post: new-post:
@./hugo new posts/$${TITLE:new_post}.md ./hugo new posts/$${TITLE:new_post}.md
docker-build-dev:
@docker build --build-arg='VERSION=0.59.1' -t hugo -f Dockerfile.dev .
serve:
./hugo server -D --log -w --bind 0.0.0.0
clean:
@rm -rf ./public ./resources
hugo: hugo:
@go get -u --tags extended -v github.com/gohugoio/hugo go get -u --tags extended -v github.com/gohugoio/hugo
go install --tags extended -v github.com/gohugoio/hugo
public: docker-build:
./hugo --minify --gc docker build --build-arg='VERSION=0.59.1' -t hugo .
serve:
./hugo server -D -w --bind 0.0.0.0

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>Categories on Adam&#39;s blog</title>
<link>https://vdhsn.com/categories/</link>
<description>Recent content in Categories on Adam&#39;s blog</description>
<generator>Hugo -- gohugo.io</generator>
<language>en-us</language>
<atom:link href="https://vdhsn.com/categories/index.xml" rel="self" type="application/rss+xml" />
</channel>
</rss>

14
public/index.xml Normal file
View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>Adam&#39;s blog</title>
<link>https://vdhsn.com/</link>
<description>Recent content on Adam&#39;s blog</description>
<generator>Hugo -- gohugo.io</generator>
<language>en-us</language>
<atom:link href="https://vdhsn.com/index.xml" rel="self" type="application/rss+xml" />
</channel>
</rss>

17
public/sitemap.xml Normal file
View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xhtml="http://www.w3.org/1999/xhtml">
<url>
<loc>https://vdhsn.com/</loc>
</url>
<url>
<loc>https://vdhsn.com/categories/</loc>
</url>
<url>
<loc>https://vdhsn.com/tags/</loc>
</url>
</urlset>

14
public/tags/index.xml Normal file
View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>Tags on Adam&#39;s blog</title>
<link>https://vdhsn.com/tags/</link>
<description>Recent content in Tags on Adam&#39;s blog</description>
<generator>Hugo -- gohugo.io</generator>
<language>en-us</language>
<atom:link href="https://vdhsn.com/tags/index.xml" rel="self" type="application/rss+xml" />
</channel>
</rss>