Compare commits
2 Commits
2b95b42eb6
...
763af607c1
| Author | SHA1 | Date |
|---|---|---|
|
|
763af607c1 | |
|
|
85778d763a |
|
|
@ -1 +1,2 @@
|
|||
resources
|
||||
public
|
||||
|
|
|
|||
31
Dockerfile
31
Dockerfile
|
|
@ -1,29 +1,2 @@
|
|||
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"]
|
||||
FROM nginx
|
||||
COPY ./public /usr/share/nginx/html
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
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"]
|
||||
|
|
@ -12,6 +12,11 @@ h1,
|
|||
h2,
|
||||
h3 {
|
||||
font-size: 12pt;
|
||||
margin: 0 0 10px 0;
|
||||
}
|
||||
|
||||
p {
|
||||
margin: 0 0 10px 0;
|
||||
}
|
||||
|
||||
.container {
|
||||
|
|
@ -24,6 +29,7 @@ h3 {
|
|||
}
|
||||
|
||||
#header {
|
||||
margin-bottom: 20px;
|
||||
grid-column-start: 1;
|
||||
grid-column-end: 3;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,18 +3,27 @@
|
|||
display: flex;
|
||||
list-style-type: none;
|
||||
padding: 0;
|
||||
margin: 0 0 10px 0;
|
||||
|
||||
li {
|
||||
margin-right: 5px;
|
||||
background-color: black;
|
||||
//background-color: black;
|
||||
padding: 0 5px;
|
||||
border-radius: 5px;
|
||||
|
||||
a {
|
||||
text-decoration: none;
|
||||
&:hover {
|
||||
text-decoration: underline;
|
||||
text-decoration-color: #cb4b16;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
p code {
|
||||
background-color: #1c1c1c;
|
||||
color: #a31515;
|
||||
color: #f73b3b;
|
||||
}
|
||||
|
||||
.postdate {
|
||||
|
|
|
|||
|
|
@ -6,16 +6,15 @@ 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
|
||||
actions in your repository. These are shell scripts in the `.git/hooks/` directory of your repository, but they can also
|
||||
exist at `~/.githooks/`.
|
||||
exist in your home directory at `~/.githooks/`.
|
||||
|
||||
Any hooks found in `~/.githooks/` are executed globally for the user of that shell, this makes it awesome for running a
|
||||
custom workflow that is consistent across your entire machine.
|
||||
Any hooks found in `~/.githooks/` are executed globally, this makes it easy to setup a custom workflow that is consistent
|
||||
across your entire machine.
|
||||
|
||||
## 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.
|
||||
## Automatically lint and test on commit
|
||||
|
||||
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
|
||||
{{<highlight bash "linenos=table">}}
|
||||
|
|
@ -39,8 +38,10 @@ fi
|
|||
{{</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
|
||||
of the lint/test results failing I can do `git commit --no-verify` to skip the `pre-commit` hook.
|
||||
of the lint/test results 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"
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
{{ range .Param $taxo }}
|
||||
{{ $name := . }}
|
||||
{{ 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 }}
|
||||
</ul>
|
||||
33
makefile
33
makefile
|
|
@ -1,16 +1,31 @@
|
|||
.PHONY: docker-build serve write
|
||||
VERSION := $(shell git rev-parse --abbrev-ref HEAD)
|
||||
.PHONY: clean docker-build-dev serve write
|
||||
|
||||
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:
|
||||
./hugo new posts/$${TITLE:new_post}.md
|
||||
@./hugo new posts/$${TITLE:new_post}.md
|
||||
|
||||
hugo:
|
||||
go get -u --tags extended -v github.com/gohugoio/hugo
|
||||
go install --tags extended -v github.com/gohugoio/hugo
|
||||
|
||||
docker-build:
|
||||
docker build --build-arg='VERSION=0.59.1' -t hugo .
|
||||
docker-build-dev:
|
||||
@docker build --build-arg='VERSION=0.59.1' -t hugo -f Dockerfile.dev .
|
||||
|
||||
serve:
|
||||
./hugo server -D -w --bind 0.0.0.0
|
||||
./hugo server -D --log -w --bind 0.0.0.0
|
||||
|
||||
clean:
|
||||
@rm -rf ./public ./resources
|
||||
|
||||
hugo:
|
||||
@go get -u --tags extended -v github.com/gohugoio/hugo
|
||||
|
||||
public:
|
||||
./hugo --minify --gc
|
||||
|
|
|
|||
|
|
@ -1,14 +0,0 @@
|
|||
<?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's blog</title>
|
||||
<link>https://vdhsn.com/categories/</link>
|
||||
<description>Recent content in Categories on Adam'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>
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
|
||||
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
||||
<channel>
|
||||
<title>Adam's blog</title>
|
||||
<link>https://vdhsn.com/</link>
|
||||
<description>Recent content on Adam'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>
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
<?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>
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
<?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's blog</title>
|
||||
<link>https://vdhsn.com/tags/</link>
|
||||
<description>Recent content in Tags on Adam'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>
|
||||
Loading…
Reference in New Issue