From 5f542201135fdb0cf5f961d610cb0191cbcd7bd7 Mon Sep 17 00:00:00 2001 From: hexlocation Date: Thu, 26 Dec 2024 13:26:45 +0100 Subject: [PATCH] test ci! --- .woodpecker.yaml | 18 ++++++++++++++++++ Dockerfile | 32 ++++++++++++++++++++++++++++++++ taskfile.yml | 13 +++++++++++-- 3 files changed, 61 insertions(+), 2 deletions(-) create mode 100644 .woodpecker.yaml create mode 100644 Dockerfile diff --git a/.woodpecker.yaml b/.woodpecker.yaml new file mode 100644 index 0000000..4f4ee31 --- /dev/null +++ b/.woodpecker.yaml @@ -0,0 +1,18 @@ +when: + branch: ["main"] + event: ["push", "manual"] +steps: + - name: build + image: woodpeckerci/plugin-docker-buildx + settings: + repo: git.iwakura.rip/hex/gw + platforms: linux/amd64 + dockerfile: Dockerfile + tags: + ["${CI_COMMIT_BRANCH}-latest", "${CI_COMMIT_BRANCH}-${CI_COMMIT_SHA}"] + username: hex + registry: + git.iwakura.rip + #insecure: true + password: + from_secret: gitpat diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..3b1fb3e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,32 @@ +FROM alpine:latest AS compile + +RUN mkdir /build + +WORKDIR /build + +# Add edge repository +RUN echo -e "\nhttps://dl-cdn.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories + +RUN apk update && \ + apk add pnpm nodejs npm nim nimble go-task git build-base + +ADD . . + +RUN go-task docker-build-frontend +RUN go-task docker-build-backend + +RUN echo $(pwd) $(ls) + +FROM alpine:latest + +WORKDIR /app + +RUN apk update && \ + apk add sqlite-dev + +COPY --from=compile /build/gw /app/ +COPY --from=compile /build/public /app/public + +CMD ["/app/gw"] + + diff --git a/taskfile.yml b/taskfile.yml index 5fc1527..ea686ea 100644 --- a/taskfile.yml +++ b/taskfile.yml @@ -4,7 +4,7 @@ tasks: build-backend: cmds: - rm gw - - nimble c -d:usestd src/gw.nim -o:gw + - nimble build build-frontend: dir: ./web cmds: @@ -16,4 +16,13 @@ tasks: dev-frontend: dir: ./web cmds: - - pnpm run dev \ No newline at end of file + - pnpm run dev + docker-build-frontend: + dir: ./web + cmds: + - pnpm install + - pnpm run build + docker-build-backend: + cmds: + - rm gw | echo "has not been compiled before" + - nimble -y build --gcc.path:"/usr/bin" --gcc.exe:"x86_64-alpine-linux-musl-gcc" --gcc.linkerexe:"x86_64-alpine-linux-musl-gcc" --gcc.options.always:"-static" --define:release --threads:on