reduced image size

This commit is contained in:
Matthias Hannig 2019-09-24 16:58:24 +02:00
parent 2584cfcd80
commit ed3751ce3a
No known key found for this signature in database
GPG Key ID: 62E226E47DDCE58D
2 changed files with 19 additions and 6 deletions

View File

@ -36,11 +36,19 @@ RUN go install github.com/GeertJohan/go.rice/rice
COPY --from=frontend /src/alice-lg/client/build client/build
# Build backend
WORKDIR /src/alice-lg
ADD VERSION .
WORKDIR /src/alice-lg/backend
ADD backend .
RUN rice embed-go
RUN go build -o alice-lg-linux-amd64 -ldflags="-X main.version=4.0.3"
# RUN go build -o alice-lg-linux-amd64 -ldflags="-X main.version=4.0.3"
RUN make alpine
FROM alpine:latest
COPY --from=backend /src/alice-lg/backend/alice-lg-linux-amd64 /usr/bin/alice-lg
RUN ls -lsha /usr/bin/alice-lg
EXPOSE 7340:7340
CMD ["/src/alice-lg/backend/alice-lg-linux-amd64"]
CMD ["/usr/bin/alice-lg"]

View File

@ -23,21 +23,26 @@ endif
LDFLAGS=-ldflags="-X main.version=$(APP_VERSION)"
FILES=$(shell find . -depth 1 ! -name "*_test.go" -name "*.go")
all: $(TARGET)
all: deps $(TARGET)
@echo "Built $(VERSION) @ $(TARGET)"
deps:
GO111MODULE=on go get -v .
osx-dev: deps
osx-dev:
GO111MODULE=on go run $(FILES)
osx: deps
osx:
GO111MODULE=on GOARCH=$(ARCH) GOOS=darwin go build $(LDFLAGS) -o $(PROG)-osx-$(ARCH)
linux: deps
linux:
GO111MODULE=on GOARCH=$(ARCH) GOOS=linux go build $(LDFLAGS) -o $(PROG)-linux-$(ARCH)
alpine:
GO111MODULE=on CGO_ENABLED=0 GOOS=linux go build \
-a -installsuffix cgo \
$(LDFLAGS) -o $(PROG)-linux-$(ARCH)
bundle:
rice embed-go