Compare commits

...

3 Commits

Author SHA1 Message Date
488af3d373 update dockerfile, add dockerignore
All checks were successful
continuous-integration/drone/push Build is passing
2020-09-21 13:00:28 -07:00
e68027843d might go faster now, who knows
All checks were successful
continuous-integration/drone/push Build is passing
2020-09-20 16:11:00 -07:00
a1cb2bfcd4 update README
All checks were successful
continuous-integration/drone/push Build is passing
2020-09-20 15:47:21 -07:00
8 changed files with 70 additions and 15 deletions

1
.dockerignore Normal file
View File

@@ -0,0 +1 @@
formless

2
.gitignore vendored
View File

@@ -1,3 +1,4 @@
formless
# ---> Go
# Binaries for programs and plugins
*.exe
@@ -12,3 +13,4 @@
# Output of the go coverage tool, specifically when used with LiteIDE
*.out
.env

View File

@@ -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
ADD . /build/
WORKDIR /build
RUN mkdir /user && \
echo 'nobody:x:65534:65534:nobody:/:' > /user/passwd && \
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 tar -c /go | bzip2 > /go.tbz2
FROM scratch
COPY --from=builder /build/formless /app/formless
COPY --from=builder /go /goarchive
## output image:
FROM scratch as final
COPY --from=builder /user/group /user/passwd /etc/
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=builder /go/src/git.eeqj.de/sneak/formless/formless /app/formless
COPY --from=builder /go.tbz2 /go.tbz2
WORKDIR /app
@@ -18,4 +32,6 @@ ENV DBURL none
EXPOSE 8080
CMD ["./formless"]
USER nobody:nobody
ENTRYPOINT ["./formless"]

View File

@@ -59,22 +59,26 @@ test: lint build-docker-image
is_uncommitted:
git diff --exit-code >/dev/null 2>&1
docker-build:
docker:
docker build -t $(IMAGENAME) .
build-docker-image-dist: is_uncommitted clean
docker build -t $(IMAGENAME):$(VERSION) -t $(IMAGENAME):latest -t $(IMAGENAME):$(BUILDTIMETAG) .
dist: lint docker-build
dist: lint docker
-mkdir -p ./output
docker run --rm --entrypoint cat $(IMAGENAME) /bin/$(FN) > output/$(FN)
docker save $(IMAGENAME) | bzip2 > output/$(BUILDTIMEFILENAME).$(FN).tbz2
hub: upload-docker-image
upload-docker-image: docker-build
upload-docker-image: docker
docker push $(IMAGENAME):$(VERSION)
docker push $(IMAGENAME):$(BUILDTIMETAG)
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

View File

@@ -1,3 +1,24 @@
# formless
Forum software. Server rendered, HTML!
## Explicit Design Goals
* Server-rendered HTML
* 100% functionality without any clientside JS
* Fast
* Simple
# Build Status
[![Build Status](https://drone.datavi.be/api/badges/sneak/formless/status.svg)](https://drone.datavi.be/sneak/formless)
# Author
https://sneak.berlin
sneak@sneak.berlin
# License
WTFPL

1
go.mod
View File

@@ -8,6 +8,7 @@ require (
github.com/gin-gonic/gin v1.6.3
github.com/google/uuid v1.1.2
github.com/jinzhu/gorm v1.9.16
github.com/joho/godotenv v1.3.0
github.com/k0kubun/pp v3.0.1+incompatible
github.com/labstack/echo v3.3.10+incompatible
github.com/labstack/gommon v0.3.0

2
go.sum
View File

@@ -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/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=
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/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
github.com/json-iterator/go v1.1.9 h1:9yzud/Ht36ygwatGx56VwCZtlI/2AD15T1X2sjSuGns=

View File

@@ -5,6 +5,8 @@ import (
"os"
"time"
"github.com/joho/godotenv"
"git.eeqj.de/sneak/formless/database"
_ "github.com/jinzhu/gorm/dialects/postgres"
_ "github.com/jinzhu/gorm/dialects/sqlite"
@@ -17,6 +19,12 @@ import (
// CLIEntry is the main entrypoint
func CLIEntry(version string, buildarch string) int {
err := godotenv.Load()
if err != nil {
panic("Error loading .env file")
}
f := new(Formless)
f.version = version
f.buildarch = buildarch