notification queue server for @gwen.works/churros

ci: fix dockerfile, add ci to build image

+163
.dockerignore
··· 1 + # Created by https://www.toptal.com/developers/gitignore/api/go,node 2 + # Edit at https://www.toptal.com/developers/gitignore?templates=go,node 3 + 4 + ### Go ### 5 + # If you prefer the allow list template instead of the deny list, see community template: 6 + # https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore 7 + # 8 + # Binaries for programs and plugins 9 + *.exe 10 + *.exe~ 11 + *.dll 12 + *.so 13 + *.dylib 14 + 15 + # Test binary, built with `go test -c` 16 + *.test 17 + 18 + # Output of the go coverage tool, specifically when used with LiteIDE 19 + *.out 20 + 21 + # Dependency directories (remove the comment below to include it) 22 + # vendor/ 23 + 24 + # Go workspace file 25 + go.work 26 + 27 + ### Node ### 28 + # Logs 29 + logs 30 + *.log 31 + npm-debug.log* 32 + yarn-debug.log* 33 + yarn-error.log* 34 + lerna-debug.log* 35 + .pnpm-debug.log* 36 + 37 + # Diagnostic reports (https://nodejs.org/api/report.html) 38 + report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json 39 + 40 + # Runtime data 41 + pids 42 + *.pid 43 + *.seed 44 + *.pid.lock 45 + 46 + # Directory for instrumented libs generated by jscoverage/JSCover 47 + lib-cov 48 + 49 + # Coverage directory used by tools like istanbul 50 + coverage 51 + *.lcov 52 + 53 + # nyc test coverage 54 + .nyc_output 55 + 56 + # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) 57 + .grunt 58 + 59 + # Bower dependency directory (https://bower.io/) 60 + bower_components 61 + 62 + # node-waf configuration 63 + .lock-wscript 64 + 65 + # Compiled binary addons (https://nodejs.org/api/addons.html) 66 + build/Release 67 + 68 + # Dependency directories 69 + node_modules/ 70 + jspm_packages/ 71 + 72 + # Snowpack dependency directory (https://snowpack.dev/) 73 + web_modules/ 74 + 75 + # TypeScript cache 76 + *.tsbuildinfo 77 + 78 + # Optional npm cache directory 79 + .npm 80 + 81 + # Optional eslint cache 82 + .eslintcache 83 + 84 + # Optional stylelint cache 85 + .stylelintcache 86 + 87 + # Microbundle cache 88 + .rpt2_cache/ 89 + .rts2_cache_cjs/ 90 + .rts2_cache_es/ 91 + .rts2_cache_umd/ 92 + 93 + # Optional REPL history 94 + .node_repl_history 95 + 96 + # Output of 'npm pack' 97 + *.tgz 98 + 99 + # Yarn Integrity file 100 + .yarn-integrity 101 + 102 + # parcel-bundler cache (https://parceljs.org/) 103 + .cache 104 + .parcel-cache 105 + 106 + # Next.js build output 107 + .next 108 + out 109 + 110 + # Nuxt.js build / generate output 111 + .nuxt 112 + dist 113 + 114 + # Gatsby files 115 + .cache/ 116 + # Comment in the public line in if your project uses Gatsby and not Next.js 117 + # https://nextjs.org/blog/next-9-1#public-directory-support 118 + # public 119 + 120 + # vuepress build output 121 + .vuepress/dist 122 + 123 + # vuepress v2.x temp and cache directory 124 + .temp 125 + 126 + # Docusaurus cache and generated files 127 + .docusaurus 128 + 129 + # Serverless directories 130 + .serverless/ 131 + 132 + # FuseBox cache 133 + .fusebox/ 134 + 135 + # DynamoDB Local files 136 + .dynamodb/ 137 + 138 + # TernJS port file 139 + .tern-port 140 + 141 + # Stores VSCode versions used for testing VSCode extensions 142 + .vscode-test 143 + 144 + # yarn v2 145 + .yarn/cache 146 + .yarn/unplugged 147 + .yarn/build-state.yml 148 + .yarn/install-state.gz 149 + .pnp.* 150 + 151 + ### Node Patch ### 152 + # Serverless Webpack directories 153 + .webpack/ 154 + 155 + # Optional stylelint cache 156 + 157 + # SvelteKit build / generate output 158 + .svelte-kit 159 + 160 + # End of https://www.toptal.com/developers/gitignore/api/go,node 161 + bin 162 + 163 + db/
+25
.gitlab-ci.yml
··· 1 + .buildkit: 2 + image: 3 + name: moby/buildkit:rootless 4 + entrypoint: ['sh', '-c'] 5 + variables: 6 + BUILDKITD_FLAGS: --oci-worker-no-process-sandbox 7 + before_script: 8 + - mkdir ~/.docker 9 + - cp $HARBOR_CONFIG_JSON ~/.docker/config.json 10 + 11 + deploy: 12 + extends: .buildkit 13 + stage: deploy 14 + rules: 15 + - if: $CI_COMMIT_TAG =~ /^\d+\.\d+\.\d+/ 16 + script: 17 + - export TAG=$(echo $CI_COMMIT_TAG) 18 + - | 19 + buildctl-daemonless.sh build \ 20 + --frontend=dockerfile.v0 \ 21 + --local context=. \ 22 + --local dockerfile=. \ 23 + --opt build-arg:TAG=$TAG \ 24 + --output type=image,name=$HARBOR_REGISTRY_IMAGE/notella:v$TAG,push=true 25 + - echo "Successfully built and pushed $HARBOR_REGISTRY_IMAGE/notella:v$TAG"
+10 -6
Dockerfile
··· 1 + ARG TAG=dev 2 + 1 3 # Stage 1: Build the Go binary using Just 2 - FROM golang:1.20 AS builder 4 + FROM golang:1.23.2 AS builder 3 5 4 6 # Install Just in the builder stage 5 - RUN apt-get update && apt-get install -y curl && \ 6 - curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | bash -s -- --to /usr/local/bin/just 7 + RUN apt-get update && apt-get install -y curl 8 + RUN curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | bash -s -- --to /app 9 + 10 + ENV PATH="/app:${PATH}" 7 11 8 12 # Set the working directory in the container 9 13 WORKDIR /app ··· 19 23 COPY . . 20 24 21 25 # Build the Go binary using Just 22 - RUN just build 26 + RUN /app/just build notella ${TAG} 23 27 24 28 # Stage 2: Create a lightweight image with just the binary 25 29 FROM alpine:latest ··· 28 32 WORKDIR /app 29 33 30 34 # Copy the binary from the builder stage 31 - COPY --from=builder /app/myapp . 35 + COPY --from=builder /app/notella . 32 36 33 37 # Expose a port (optional) 34 38 EXPOSE 8080 35 39 36 40 # Command to run the binary 37 - CMD ["./myapp"] 41 + CMD ["./notella"]
+10 -10
Justfile
··· 6 6 go fmt 7 7 go run server/*.go 8 8 9 - build: 9 + build output="bin/server" tag="{{current_version}}": 10 10 just genprisma 11 11 go mod tidy 12 - go build -v -ldflags="-X main.Version={{current_version}}" -o bin/server server/*.go 12 + go build -v -ldflags="-X main.Version={{tag}}" -o {{output}} server/*.go 13 13 14 14 docker: 15 - docker build -t notella:{{current_version}} . 16 - docker tag notella:{{current_version}} notella:latest 17 - docker tag notella:{{current_version}} harbor.k8s.inpt.fr/net7/notella:{{current_version}} 18 - docker tag notella:{{current_version}} harbor.k8s.inpt.fr/net7/notella:latest 19 - docker push notella:{{current_version}} 20 - docker push notella:latest 21 - docker push harbor.k8s.inpt.fr/net7/notella:{{current_version}} 22 - docker push harbor.k8s.inpt.fr/net7/notella:latest 15 + docker build -t uwun/notella:{{current_version}} . --build-arg TAG={{current_version}} 16 + docker tag uwun/notella:{{current_version}} uwun/notella:latest 17 + docker tag uwun/notella:{{current_version}} harbor.k8s.inpt.fr/net7/churros/notella:{{current_version}} 18 + docker tag uwun/notella:{{current_version}} harbor.k8s.inpt.fr/net7/churros/notella:latest 19 + docker push uwun/notella:{{current_version}} 20 + docker push uwun/notella:latest 21 + docker push harbor.k8s.inpt.fr/net7/churros/notella:{{current_version}} 22 + docker push harbor.k8s.inpt.fr/net7/churros/notella:latest 23 23 24 24 25 25 install: