dockerify
Signed-off-by: Naman Sood <mail@nsood.in>
This commit is contained in:
parent
969291afcd
commit
7cc0d4132c
41 changed files with 34 additions and 5 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1,2 +1,2 @@
|
|||
# ignore the binary
|
||||
prose
|
||||
/prose
|
||||
|
|
24
Dockerfile
Normal file
24
Dockerfile
Normal file
|
@ -0,0 +1,24 @@
|
|||
FROM golang:bookworm
|
||||
|
||||
WORKDIR /
|
||||
ENV SASS_VERSION=1.72.0
|
||||
ENV SASS_TARFILE="dart-sass-${SASS_VERSION}-linux-x64.tar.gz"
|
||||
ADD "https://github.com/sass/dart-sass/releases/download/$SASS_VERSION/$SASS_TARFILE" .
|
||||
RUN tar -xf $SASS_TARFILE
|
||||
RUN mv dart-sass/* bin/
|
||||
|
||||
WORKDIR /prose
|
||||
COPY --link go.mod go.sum ./
|
||||
COPY --link cmd/prose cmd/prose
|
||||
RUN go build ./cmd/prose
|
||||
|
||||
WORKDIR /bin
|
||||
RUN cp /prose/prose .
|
||||
|
||||
WORKDIR /srv
|
||||
COPY --link posts posts
|
||||
COPY --link static static
|
||||
COPY --link styles styles
|
||||
COPY --link templates templates
|
||||
ENV PATH=/bin
|
||||
ENTRYPOINT ["prose"]
|
|
@ -14,10 +14,15 @@ Posts will be served as `/title-slug`, and files like `static/random/file/struct
|
|||
|
||||
To start the server:
|
||||
|
||||
go run .
|
||||
go run ./cmd/prose
|
||||
|
||||
Server will be live on port 8080.
|
||||
|
||||
The server can be deployed on a willing host using Docker:
|
||||
|
||||
docker build -t prose .
|
||||
docker run -p 8080:8080 -it prose
|
||||
|
||||
## License
|
||||
|
||||
The code in this repository (everything other than the contents of `posts/` and `static/`) is licensed under the MIT license; see LICENSE.md. The blog posts themselves are licensed under [CC-BY-ND 4.0](https://creativecommons.org/licenses/by-nd/4.0/).
|
||||
|
|
|
@ -265,15 +265,15 @@ func createImage(title, summary, url string, out io.Writer) error {
|
|||
|
||||
draw := gg.NewContext(imgWidth, imgHeight)
|
||||
|
||||
titleFont, err := gg.LoadFontFace("fonts/Nunito-Bold.ttf", titleSize)
|
||||
titleFont, err := gg.LoadFontFace("static/fonts/Nunito-Bold.ttf", titleSize)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
summaryFont, err := gg.LoadFontFace("fonts/Nunito-LightItalic.ttf", summarySize)
|
||||
summaryFont, err := gg.LoadFontFace("static/fonts/Nunito-LightItalic.ttf", summarySize)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
urlFont, err := gg.LoadFontFace("fonts/JetBrainsMono-ExtraLight.ttf", urlSize)
|
||||
urlFont, err := gg.LoadFontFace("static/fonts/JetBrainsMono-ExtraLight.ttf", urlSize)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue