From feadd20f226c60f83bec328dc255bd6b08cc8d2a Mon Sep 17 00:00:00 2001 From: Midou36O Date: Wed, 30 Nov 2022 12:23:14 +0100 Subject: [PATCH 1/4] Add CI --- .woodpecker.yml | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .woodpecker.yml diff --git a/.woodpecker.yml b/.woodpecker.yml new file mode 100644 index 0000000..61a0282 --- /dev/null +++ b/.woodpecker.yml @@ -0,0 +1,37 @@ +pipeline: + build: + when: + event: [push, pull_request, tag] + image: golang:1.19.3-alpine + commands: + - go mod download + - go build . + dockerize: + when: + branch: [main, master] + event: [push] + image: plugins/docker + settings: + registry: codeberg.org + repo: codeberg.org/odyssium/gothub + username: + from_secret: user + password: + from_secret: passwd + # password = key or actual password + tags: latest + dockerize-dev: + when: + event: [push] + branch: [dev] + image: plugins/docker + settings: + registry: codeberg.org + repo: codeberg.org/odyssium/gothub + username: + from_secret: user + password: + from_secret: passwd + # password = key or actual password + tags: dev + From a288859e2e12f38350a97bc76e075e1072f60b17 Mon Sep 17 00:00:00 2001 From: Midou36O Date: Wed, 30 Nov 2022 12:37:51 +0100 Subject: [PATCH 2/4] Forgot the Dockerfile --- Dockerfile | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..deb9892 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,8 @@ +FROM golang:1.19.3-alpine +WORKDIR /gothub +COPY . . +RUN go mod download +RUN go build . +CMD ["/bin/sh", "-c", "./gothub"] +EXPOSE 3000 + From 635c93eded592755e7e033f45f91a4ee303667a6 Mon Sep 17 00:00:00 2001 From: Midou36O Date: Wed, 30 Nov 2022 12:51:27 +0100 Subject: [PATCH 3/4] Separate the docker image --- Dockerfile | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index deb9892..64aee73 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,6 @@ -FROM golang:1.19.3-alpine +FROM alpine:latest WORKDIR /gothub -COPY . . -RUN go mod download -RUN go build . +COPY ./gothub . CMD ["/bin/sh", "-c", "./gothub"] EXPOSE 3000 From 21165c8c773b88ce3e1de1fcbfeb5898e33d893e Mon Sep 17 00:00:00 2001 From: Midou36O Date: Wed, 30 Nov 2022 14:43:44 +0100 Subject: [PATCH 4/4] Docker + CI should both work now --- Dockerfile | 3 ++- main.go | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 64aee73..a49f60c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,7 @@ FROM alpine:latest WORKDIR /gothub COPY ./gothub . +COPY ./public/ ./public/ +COPY ./views/ ./views/ CMD ["/bin/sh", "-c", "./gothub"] EXPOSE 3000 - diff --git a/main.go b/main.go index 78642b9..f1cefea 100644 --- a/main.go +++ b/main.go @@ -36,7 +36,7 @@ func main() { app := fiber.New(fiber.Config{ Views: engine, - Prefork: true, + Prefork: false, AppName: "GotHub", // fucked up way to fix rate limits EnableTrustedProxyCheck: true,