Compare commits
3 Commits
905082c769
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 488af3d373 | |||
| e68027843d | |||
| a1cb2bfcd4 |
1
.dockerignore
Normal file
1
.dockerignore
Normal file
@@ -0,0 +1 @@
|
|||||||
|
formless
|
||||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,3 +1,4 @@
|
|||||||
|
formless
|
||||||
# ---> Go
|
# ---> Go
|
||||||
# Binaries for programs and plugins
|
# Binaries for programs and plugins
|
||||||
*.exe
|
*.exe
|
||||||
@@ -12,3 +13,4 @@
|
|||||||
# Output of the go coverage tool, specifically when used with LiteIDE
|
# Output of the go coverage tool, specifically when used with LiteIDE
|
||||||
*.out
|
*.out
|
||||||
|
|
||||||
|
.env
|
||||||
|
|||||||
36
Dockerfile
36
Dockerfile
@@ -1,15 +1,29 @@
|
|||||||
FROM golang:1.15 as builder
|
## build image:
|
||||||
|
ARG GO_VERSION=1.15
|
||||||
|
FROM golang:${GO_VERSION}-alpine AS builder
|
||||||
|
|
||||||
RUN mkdir /build
|
RUN mkdir /user && \
|
||||||
ADD . /build/
|
echo 'nobody:x:65534:65534:nobody:/:' > /user/passwd && \
|
||||||
WORKDIR /build
|
echo 'nobody:x:65534:' > /user/group
|
||||||
|
RUN apk add --no-cache ca-certificates git bzip2 make gcc libc-dev
|
||||||
|
|
||||||
|
RUN mkdir -p /go/src/git.eeqj.de/sneak/formless
|
||||||
|
WORKDIR /go/src/git.eeqj.de/sneak/formless
|
||||||
|
|
||||||
|
COPY go.mod .
|
||||||
|
COPY go.sum .
|
||||||
|
RUN go mod download
|
||||||
|
|
||||||
|
COPY ./ ./
|
||||||
RUN make build
|
RUN make build
|
||||||
|
RUN tar -c /go | bzip2 > /go.tbz2
|
||||||
|
|
||||||
|
## output image:
|
||||||
FROM scratch
|
FROM scratch as final
|
||||||
|
COPY --from=builder /user/group /user/passwd /etc/
|
||||||
COPY --from=builder /build/formless /app/formless
|
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
|
||||||
COPY --from=builder /go /goarchive
|
COPY --from=builder /go/src/git.eeqj.de/sneak/formless/formless /app/formless
|
||||||
|
COPY --from=builder /go.tbz2 /go.tbz2
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
@@ -18,4 +32,6 @@ ENV DBURL none
|
|||||||
|
|
||||||
EXPOSE 8080
|
EXPOSE 8080
|
||||||
|
|
||||||
CMD ["./formless"]
|
USER nobody:nobody
|
||||||
|
|
||||||
|
ENTRYPOINT ["./formless"]
|
||||||
|
|||||||
12
Makefile
12
Makefile
@@ -59,22 +59,26 @@ test: lint build-docker-image
|
|||||||
is_uncommitted:
|
is_uncommitted:
|
||||||
git diff --exit-code >/dev/null 2>&1
|
git diff --exit-code >/dev/null 2>&1
|
||||||
|
|
||||||
docker-build:
|
docker:
|
||||||
docker build -t $(IMAGENAME) .
|
docker build -t $(IMAGENAME) .
|
||||||
|
|
||||||
build-docker-image-dist: is_uncommitted clean
|
build-docker-image-dist: is_uncommitted clean
|
||||||
docker build -t $(IMAGENAME):$(VERSION) -t $(IMAGENAME):latest -t $(IMAGENAME):$(BUILDTIMETAG) .
|
docker build -t $(IMAGENAME):$(VERSION) -t $(IMAGENAME):latest -t $(IMAGENAME):$(BUILDTIMETAG) .
|
||||||
|
|
||||||
dist: lint docker-build
|
dist: lint docker
|
||||||
-mkdir -p ./output
|
-mkdir -p ./output
|
||||||
docker run --rm --entrypoint cat $(IMAGENAME) /bin/$(FN) > output/$(FN)
|
docker run --rm --entrypoint cat $(IMAGENAME) /bin/$(FN) > output/$(FN)
|
||||||
docker save $(IMAGENAME) | bzip2 > output/$(BUILDTIMEFILENAME).$(FN).tbz2
|
docker save $(IMAGENAME) | bzip2 > output/$(BUILDTIMEFILENAME).$(FN).tbz2
|
||||||
|
|
||||||
hub: upload-docker-image
|
hub: upload-docker-image
|
||||||
|
|
||||||
upload-docker-image: docker-build
|
upload-docker-image: docker
|
||||||
docker push $(IMAGENAME):$(VERSION)
|
docker push $(IMAGENAME):$(VERSION)
|
||||||
docker push $(IMAGENAME):$(BUILDTIMETAG)
|
docker push $(IMAGENAME):$(BUILDTIMETAG)
|
||||||
docker push $(IMAGENAME):latest
|
docker push $(IMAGENAME):latest
|
||||||
|
|
||||||
.PHONY: build fmt test is_uncommitted docker-build dist hub upload-docker-image clean run rundebug default build-docker-image-dist
|
vet:
|
||||||
|
go vet ./...
|
||||||
|
bash -c 'test -z "$$(gofmt -l .)"'
|
||||||
|
|
||||||
|
.PHONY: build fmt test is_uncommitted docker dist hub upload-docker-image clean run rundebug default build-docker-image-dist
|
||||||
|
|||||||
21
README.md
21
README.md
@@ -1,3 +1,24 @@
|
|||||||
# formless
|
# formless
|
||||||
|
|
||||||
Forum software. Server rendered, HTML!
|
Forum software. Server rendered, HTML!
|
||||||
|
|
||||||
|
## Explicit Design Goals
|
||||||
|
|
||||||
|
* Server-rendered HTML
|
||||||
|
* 100% functionality without any clientside JS
|
||||||
|
* Fast
|
||||||
|
* Simple
|
||||||
|
|
||||||
|
# Build Status
|
||||||
|
|
||||||
|
[](https://drone.datavi.be/sneak/formless)
|
||||||
|
|
||||||
|
# Author
|
||||||
|
|
||||||
|
https://sneak.berlin
|
||||||
|
|
||||||
|
sneak@sneak.berlin
|
||||||
|
|
||||||
|
# License
|
||||||
|
|
||||||
|
WTFPL
|
||||||
|
|||||||
1
go.mod
1
go.mod
@@ -8,6 +8,7 @@ require (
|
|||||||
github.com/gin-gonic/gin v1.6.3
|
github.com/gin-gonic/gin v1.6.3
|
||||||
github.com/google/uuid v1.1.2
|
github.com/google/uuid v1.1.2
|
||||||
github.com/jinzhu/gorm v1.9.16
|
github.com/jinzhu/gorm v1.9.16
|
||||||
|
github.com/joho/godotenv v1.3.0
|
||||||
github.com/k0kubun/pp v3.0.1+incompatible
|
github.com/k0kubun/pp v3.0.1+incompatible
|
||||||
github.com/labstack/echo v3.3.10+incompatible
|
github.com/labstack/echo v3.3.10+incompatible
|
||||||
github.com/labstack/gommon v0.3.0
|
github.com/labstack/gommon v0.3.0
|
||||||
|
|||||||
2
go.sum
2
go.sum
@@ -123,6 +123,8 @@ github.com/jinzhu/gorm v1.9.16/go.mod h1:G3LB3wezTOWM2ITLzPxEXgSkOXAntiLHS7UdBef
|
|||||||
github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E=
|
github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E=
|
||||||
github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=
|
github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=
|
||||||
github.com/jinzhu/now v1.0.1/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
|
github.com/jinzhu/now v1.0.1/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
|
||||||
|
github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc=
|
||||||
|
github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg=
|
||||||
github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo=
|
github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo=
|
||||||
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
|
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
|
||||||
github.com/json-iterator/go v1.1.9 h1:9yzud/Ht36ygwatGx56VwCZtlI/2AD15T1X2sjSuGns=
|
github.com/json-iterator/go v1.1.9 h1:9yzud/Ht36ygwatGx56VwCZtlI/2AD15T1X2sjSuGns=
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/joho/godotenv"
|
||||||
|
|
||||||
"git.eeqj.de/sneak/formless/database"
|
"git.eeqj.de/sneak/formless/database"
|
||||||
_ "github.com/jinzhu/gorm/dialects/postgres"
|
_ "github.com/jinzhu/gorm/dialects/postgres"
|
||||||
_ "github.com/jinzhu/gorm/dialects/sqlite"
|
_ "github.com/jinzhu/gorm/dialects/sqlite"
|
||||||
@@ -17,6 +19,12 @@ import (
|
|||||||
|
|
||||||
// CLIEntry is the main entrypoint
|
// CLIEntry is the main entrypoint
|
||||||
func CLIEntry(version string, buildarch string) int {
|
func CLIEntry(version string, buildarch string) int {
|
||||||
|
|
||||||
|
err := godotenv.Load()
|
||||||
|
if err != nil {
|
||||||
|
panic("Error loading .env file")
|
||||||
|
}
|
||||||
|
|
||||||
f := new(Formless)
|
f := new(Formless)
|
||||||
f.version = version
|
f.version = version
|
||||||
f.buildarch = buildarch
|
f.buildarch = buildarch
|
||||||
|
|||||||
Reference in New Issue
Block a user