diff --git a/README.md b/README.md index 8488e2f..18cbad8 100644 --- a/README.md +++ b/README.md @@ -173,6 +173,30 @@ server "example.org" { Don't forget to `rcctl reload httpd` your configuration changes. +### Docker + +Clone repo, alter gosh.yaml according to your needs and build container with contrib/docker/dockerfile + +or + +use provided image from dockerhub + +``` docker-compose +version: "3.8" +services: + gosh: + image: gorja/gosh:0.6.0 + restart: unless-stopped + ports: + - 8080:80 +``` + +or if you prefer docker run command + +``` docker run +docker run -p 8080:80 gorja/gosh:0.6.0 +``` + ## Running gosh diff --git a/contrib/docker/dockerfile b/contrib/docker/dockerfile new file mode 100644 index 0000000..acdb113 --- /dev/null +++ b/contrib/docker/dockerfile @@ -0,0 +1,38 @@ +# build stage +## import image +FROM golang:alpine AS build_base + +## add git +RUN apk add --no-cache git + +## cd into global 700 dir (image specific) +WORKDIR /go + +## populate the module cache based on the go.{mod,sum} files. +COPY go.mod . +COPY go.sum . +## download the modules +RUN go mod download + +## copy all files into build stage +COPY . . +## BUILD BUILD BUILD! +RUN go build -o ./out/gosh . + + +# run stage +## import image +FROM alpine:latest +## install certificates +RUN apk add ca-certificates + +## copy app from build stage to run stage +COPY --from=build_base /go/out/gosh /app/gosh + +## copy files from build stage to run stage +COPY --from=build_base /go/* /app + +## expose port +EXPOSE 8080 +## run app +CMD ["/app/gosh", "-config", "/app/gosh.yml"]