From b2569647fb47b221ef25e8bb004d63a8e7fcd4d7 Mon Sep 17 00:00:00 2001 From: Julian Hamann Date: Sun, 18 Feb 2024 11:52:01 +0100 Subject: [PATCH 1/4] added dockerfile added and testet dockerfile --- dockerfile | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 dockerfile diff --git a/dockerfile b/dockerfile new file mode 100644 index 0000000..acdb113 --- /dev/null +++ b/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"] From 2b30674ded71602f5c421882e01b4dabd5b095ae Mon Sep 17 00:00:00 2001 From: Julian Hamann Date: Sun, 18 Feb 2024 12:34:08 +0100 Subject: [PATCH 2/4] docker readme and dockerfile --- README.md | 24 ++++++++++++++++++++++++ contrib/docker/dockerfile | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 contrib/docker/dockerfile diff --git a/README.md b/README.md index 8488e2f..5de60da 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 + +Simply 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"] From ea5ed02bec8bb0d37e8c015dcc6bc463c7573305 Mon Sep 17 00:00:00 2001 From: Julian Hamann Date: Sun, 18 Feb 2024 12:36:00 +0100 Subject: [PATCH 3/4] init dockerfil added dockerfile and updated readme --- dockerfile | 38 -------------------------------------- 1 file changed, 38 deletions(-) delete mode 100644 dockerfile diff --git a/dockerfile b/dockerfile deleted file mode 100644 index acdb113..0000000 --- a/dockerfile +++ /dev/null @@ -1,38 +0,0 @@ -# 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"] From ca07d9c79ed4bb5eb202dcdfd78d90a3f66833b0 Mon Sep 17 00:00:00 2001 From: Julian Hamann Date: Sun, 18 Feb 2024 12:38:17 +0100 Subject: [PATCH 4/4] README.md typos --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 5de60da..18cbad8 100644 --- a/README.md +++ b/README.md @@ -173,9 +173,9 @@ server "example.org" { Don't forget to `rcctl reload httpd` your configuration changes. -### docker +### Docker -Simply clone repo, alter gosh.yaml according to your needs and build container with contrib/docker/dockerfile +Clone repo, alter gosh.yaml according to your needs and build container with contrib/docker/dockerfile or