Added docker support
This commit is contained in:
parent
937216bda6
commit
9b0723fb79
|
@ -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
|
|
@ -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"]
|
|
@ -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
|
Loading…
Reference in New Issue