mirror of
https://github.com/Luzifer/share.git
synced 2024-12-20 18:41:17 +00:00
Add dockerized version
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
1025b97ac6
commit
9ac02053ff
2 changed files with 20 additions and 4 deletions
16
Dockerfile
Normal file
16
Dockerfile
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
FROM golang:alpine
|
||||||
|
|
||||||
|
LABEL maintainer "Knut Ahlers <knut@ahlers.me>"
|
||||||
|
|
||||||
|
ADD . /go/src/github.com/Luzifer/share
|
||||||
|
WORKDIR /go/src/github.com/Luzifer/share
|
||||||
|
|
||||||
|
RUN set -ex \
|
||||||
|
&& apk add --update git ca-certificates \
|
||||||
|
&& go install -ldflags "-X main.version=$(git describe --tags || git rev-parse --short HEAD || echo dev)" \
|
||||||
|
&& apk del --purge git
|
||||||
|
|
||||||
|
EXPOSE 3000
|
||||||
|
|
||||||
|
ENTRYPOINT ["/go/bin/share"]
|
||||||
|
CMD ["--"]
|
8
main.go
8
main.go
|
@ -14,11 +14,11 @@ import (
|
||||||
|
|
||||||
var (
|
var (
|
||||||
cfg = struct {
|
cfg = struct {
|
||||||
BaseURL string `flag:"base-url" default:"" description:"URL to prepend before filename"`
|
BaseURL string `flag:"base-url" env:"BASE_URL" default:"" description:"URL to prepend before filename"`
|
||||||
BasePath string `flag:"base-path" default:"file/{{ printf \"%.2s\" .Hash }}/{{.Hash}}" description:"Path to upload the file to"`
|
BasePath string `flag:"base-path" env:"BASE_PATH" default:"file/{{ printf \"%.2s\" .Hash }}/{{.Hash}}" description:"Path to upload the file to"`
|
||||||
Bootstrap bool `flag:"bootstrap" default:"false" description:"Upload frontend files into bucket"`
|
Bootstrap bool `flag:"bootstrap" default:"false" description:"Upload frontend files into bucket"`
|
||||||
Bucket string `flag:"bucket" default:"" description:"S3 bucket to upload files to" validate:"nonzero"`
|
Bucket string `flag:"bucket" env:"BUCKET" default:"" description:"S3 bucket to upload files to" validate:"nonzero"`
|
||||||
Listen string `flag:"listen" default:"" description:"Enable HTTP server if set to IP/Port (e.g. ':3000')"`
|
Listen string `flag:"listen" env:"LISTEN" default:"" description:"Enable HTTP server if set to IP/Port (e.g. ':3000')"`
|
||||||
VersionAndExit bool `flag:"version" default:"false" description:"Prints current version and exits"`
|
VersionAndExit bool `flag:"version" default:"false" description:"Prints current version and exits"`
|
||||||
}{}
|
}{}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue