File tree 8 files changed +77
-6
lines changed
8 files changed +77
-6
lines changed Original file line number Diff line number Diff line change
1
+ about
1
2
_site
2
3
_attic
4
+ .git
5
+ Dockerfile
Original file line number Diff line number Diff line change 1
- FROM jekyll/jekyll:3 as builder
1
+ FROM jekyll/jekyll:4 as builder
2
2
RUN NOKOGIRI_USE_SYSTEM_LIBRARIES=true gem install html-proofer
3
3
ADD . /site
4
4
WORKDIR /site
5
5
RUN mkdir _site
6
6
RUN jekyll build
7
- RUN /usr/gem/bin/htmlproofer ./ _site --disable-external
7
+ RUN /usr/gem/bin/htmlproofer _site --disable-external
8
8
9
- FROM bign8/static:latest
10
- COPY --from=builder /site/_site /data/
11
- EXPOSE 8080
9
+ FROM golang:1.16-alpine as go
10
+ WORKDIR /go/src
11
+ COPY --from=builder /site/_site ./_site
12
+ ADD main.go go.mod ./
13
+ RUN CGO_ENABLED=0 go build -ldflags="-s -w" -o /go/bin/about -v
14
+
15
+ FROM scratch
16
+ COPY --from=go /go/bin/about /about
17
+ ENTRYPOINT ["/about" ]
Original file line number Diff line number Diff line change 7
7
- Dockerfile
8
8
- README.md
9
9
- makefile
10
+ - main.go
11
+ - go.mod
12
+ - ship.sh
13
+ - about.service
Original file line number Diff line number Diff line change
1
+ [Unit]
2
+ Description =About service
3
+ After =network.target
4
+
5
+ [Service]
6
+ Type =simple
7
+ Restart =always
8
+ RestartSec =1
9
+ User =root
10
+ WorkingDirectory =/opt/bign8
11
+ ExecStartPre =/bin/cp /opt/bign8/about /opt/bign8/about.run
12
+ ExecStart =/opt/bign8/about.run
13
+ Environment ="PORT=9999"
14
+
15
+ [Install]
16
+ WantedBy =multi-user.target
Original file line number Diff line number Diff line change
1
+ module bign8.info/about
2
+
3
+ go 1.16
Original file line number Diff line number Diff line change
1
+ package main
2
+
3
+ import (
4
+ "embed"
5
+ "io/fs"
6
+ "log"
7
+ "net/http"
8
+ "os"
9
+ )
10
+
11
+ //go:embed _site
12
+ var site embed.FS
13
+
14
+ func main () {
15
+ root , err := fs .Sub (site , "_site" )
16
+ if err != nil {
17
+ log .Fatal (err )
18
+ }
19
+ p := ":" + os .Getenv ("PORT" )
20
+ if p == ":" {
21
+ log .Fatal ("Missing PORT variable" )
22
+ }
23
+ log .Printf ("Serving on %s" , p )
24
+ http .Handle ("/" , http .FileServer (http .FS (root )))
25
+ if err := http .ListenAndServe (p , nil ); err != nil {
26
+ log .Fatal (err )
27
+ }
28
+ }
Original file line number Diff line number Diff line change 3
3
.PHONY: =docker
4
4
5
5
serve :
6
- docker run --rm --label=jekyll --volume=$(shell pwd) :/srv/jekyll -it -p 4000:4000 jekyll/jekyll jekyll serve --watch --drafts
6
+ docker run --rm --label=jekyll --volume=$(shell pwd) :/srv/jekyll -it -p 4000:4000 jekyll/jekyll:4 jekyll serve --watch --drafts
7
7
.PHONY: =serve
8
8
9
9
deploy : docker
Original file line number Diff line number Diff line change
1
+ #! /bin/bash -ex
2
+
3
+ rm -rf _site about.gz
4
+
5
+ docker run --rm --volume=$( pwd) :/srv/jekyll -it jekyll/jekyll:4 jekyll build --quiet
6
+ go build -o about -v -ldflags=" -w -s" .
7
+ gzip about
8
+ scp about.service about.gz me.bign8.info:/opt/bign8
9
+ ssh me.bign8.info -- " gzip -df /opt/bign8/about.gz && sudo systemctl daemon-reload && sudo systemctl restart about"
10
+
11
+ rm -rf _site about.gz
You can’t perform that action at this time.
0 commit comments