diff --git a/.woodpecker/deploy-docker.yml b/.woodpecker/deploy-docker.yml new file mode 100644 index 0000000..4258e49 --- /dev/null +++ b/.woodpecker/deploy-docker.yml @@ -0,0 +1,16 @@ +when: + event: + - push + +pipeline: + docker-deploy-push: + image: woodpeckerci/plugin-docker-buildx + settings: + dockerfile: Dockerfile + platforms: linux/arm/v7,linux/arm64/v8,linux/amd64,linux/ppc64le + repo: codeberg.org/lauralani/go-urlsh + registry: codeberg.org + tags: latest + username: lauralani + password: + from_secret: codeberg_token \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..653ef29 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,29 @@ +FROM golang:1.20-alpine AS dev + +COPY . /var/app +WORKDIR /var/app + +ENV GO111MODULE="on" \ + CGO_ENABLED=0 \ + GOOS=linux + +EXPOSE 80 +ENTRYPOINT ["sh"] + + +FROM dev as build + +RUN go mod download && go mod verify +RUN go build -o go-urlsh main.go +RUN chmod +x go-urlsh + + +FROM scratch AS prod + +WORKDIR /var/app +COPY --from=build /var/app/go-urlsh /var/app/ +COPY --from=build /var/app/web /var/app/web + +EXPOSE 80 +ENTRYPOINT ["/var/app/go-urlsh"] +CMD "" \ No newline at end of file