diff --git a/Dockerfile b/Dockerfile index fd47442e4..b14c93dc6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,16 +23,18 @@ RUN make clean install assets build # STEP 2 build a small image including module support # -FROM alpine:3.11 +FROM alpine:3.12 WORKDIR /evcc +ENV TZ=Europe/Berlin + # Import from builder COPY --from=builder /usr/share/zoneinfo /usr/share/zoneinfo COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ COPY --from=builder /build/evcc /usr/local/bin/evcc -COPY bin/* /evcc/ +COPY docker/bin/* /evcc/ # UI and /api EXPOSE 7070/tcp diff --git a/Makefile b/Makefile index ca6f3cd76..af606ecac 100644 --- a/Makefile +++ b/Makefile @@ -1,11 +1,13 @@ -.PHONY: default clean install lint test assets build binaries publish-images test-release release +.PHONY: default clean install lint test assets build binaries test-release release publish-testing publish-latest publish-images TAG_NAME := $(shell git describe --abbrev=0 --tags) SHA := $(shell git rev-parse --short HEAD) VERSION := $(if $(TAG_NAME),$(TAG_NAME),$(SHA)) - BUILD_DATE := $(shell date -u '+%Y-%m-%d_%H:%M:%S') +ALPINE := 3.12 +TARGETS := arm.v6,arm.v8,amd64 + default: clean install assets lint test build clean: @@ -31,20 +33,23 @@ build: @echo Version: $(VERSION) $(BUILD_DATE) go build -v -tags=release -ldflags '-X "github.com/andig/evcc/server.Version=${VERSION}" -X "github.com/andig/evcc/server.Commit=${SHA}"' -test-images: - @echo Version: $(VERSION) $(BUILD_DATE) - seihon publish -v "testing" --image-name andig/evcc --base-runtime-image alpine --dry-run=false --targets=amd64 - -publish-images: - @echo Version: $(VERSION) $(BUILD_DATE) - seihon publish -v "$(TAG_NAME)" -v "latest" --image-name andig/evcc --base-runtime-image alpine --dry-run=false --targets=arm.v6,arm.v8,amd64 - -publish-latest: - @echo Version: $(VERSION) $(BUILD_DATE) - seihon publish -v "latest" --image-name andig/evcc --base-runtime-image alpine --dry-run=false --targets=arm.v6,arm.v8,amd64 - -test-release: +release-test: goreleaser --snapshot --skip-publish --rm-dist release: goreleaser --rm-dist + +publish-testing: + @echo Version: $(VERSION) $(BUILD_DATE) + seihon publish --dry-run=false --template docker/tmpl.Dockerfile --base-runtime-image alpine:$(ALPINE) \ + --image-name andig/evcc -v "testing" --targets=amd64 + +publish-latest: + @echo Version: $(VERSION) $(BUILD_DATE) + seihon publish --dry-run=false --template docker/tmpl.Dockerfile --base-runtime-image alpine:$(ALPINE) \ + --image-name andig/evcc -v "latest" --targets=$(TARGETS) + +publish-images: + @echo Version: $(VERSION) $(BUILD_DATE) + seihon publish --dry-run=false --template docker/tmpl.Dockerfile --base-runtime-image alpine:$(ALPINE) \ + --image-name andig/evcc -v "latest" -v "$(TAG_NAME)" --targets=$(TARGETS) diff --git a/bin/docker-btmgmt b/docker/bin/docker-btmgmt similarity index 100% rename from bin/docker-btmgmt rename to docker/bin/docker-btmgmt diff --git a/bin/entrypoint.sh b/docker/bin/entrypoint.sh similarity index 100% rename from bin/entrypoint.sh rename to docker/bin/entrypoint.sh diff --git a/tmpl.Dockerfile b/docker/tmpl.Dockerfile similarity index 95% rename from tmpl.Dockerfile rename to docker/tmpl.Dockerfile index 85e3222e8..53ef1d072 100644 --- a/tmpl.Dockerfile +++ b/docker/tmpl.Dockerfile @@ -24,12 +24,14 @@ RUN GOARCH={{ .GoARCH }} GOARM={{ .GoARM }} make build ############################# FROM {{ .RuntimeImage }} +ENV TZ=Europe/Berlin + # Import from builder COPY --from=builder /usr/share/zoneinfo /usr/share/zoneinfo COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ COPY --from=builder /build/evcc /usr/local/bin/evcc -COPY bin/* /evcc/ +COPY docker/bin/* /evcc/ EXPOSE 7070