diff --git a/docker-compose-deploy.yml b/docker-compose-deploy.yml new file mode 100644 index 0000000..3a8467d --- /dev/null +++ b/docker-compose-deploy.yml @@ -0,0 +1,8 @@ +version: '3.1' + +services: + rem: + image: registry.bbr-dev.info/resource-manager/backend:latest-dev + restart: on-failure + ports: + - 5201:5201 \ No newline at end of file diff --git a/dockerfile b/dockerfile new file mode 100644 index 0000000..36ce28d --- /dev/null +++ b/dockerfile @@ -0,0 +1,19 @@ +### STAGE 1.a: Prepare certs ### +FROM alpine:latest as certs +RUN apk --update add ca-certificates + +### STAGE 1.b: Build ### +FROM golang as go-build +WORKDIR /root +COPY go.mod go.sum ./ +# install packages +RUN go mod download +COPY . . +ENV CGO_ENABLED=0 +RUN go build -tags timetzdata resource_manager + +### Stage 2: Run ### +FROM scratch +COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt +COPY --from=go-build /root/resource_manager /usr/bin/resource_manager +ENTRYPOINT ["resource_manager"] diff --git a/makefile b/makefile new file mode 100644 index 0000000..0440b12 --- /dev/null +++ b/makefile @@ -0,0 +1,33 @@ +# scripts for building account tracker backend +# requires go 1.18+ and git installed + +VERSION := 0.0.1 + +serve: + go run ./... + +setup: + go get + +docker-dev: + docker image build -t registry.bbr-dev.info/resource-manager/backend:$(VERSION)-dev . + docker tag registry.bbr-dev.info/resource-manager/backend:$(VERSION)-dev registry.bbr-dev.info/resource-manager/backend:latest-dev + docker image push registry.bbr-dev.info/resource-manager/backend:$(VERSION)-dev + docker image push registry.bbr-dev.info/resource-manager/backend:latest-dev + + +docker-prod: + docker image build -t registry.bbr-dev.info/resource-manager/backend:$(VERSION) . + docker tag registry.bbr-dev.info/resource-manager/backend:$(VERSION) registry.bbr-dev.info/resource-manager/backend:latest + docker image push registry.bbr-dev.info/resource-manager/backend:$(VERSION) + docker image push registry.bbr-dev.info/resource-manager/backend:latest + +release: + git tag $(VERSION) + git push origin $(VERSION) + +test: + go test ./... + +clean: + rm -rf resource-manager \ No newline at end of file