mirror of https://github.com/statping/statping
docker multistage build
parent
41f944c237
commit
b2fdaa5c14
24
Dockerfile
24
Dockerfile
|
@ -1,11 +1,31 @@
|
||||||
|
FROM golang:1.11-alpine as base
|
||||||
|
MAINTAINER "Hunter Long (https://github.com/hunterlong)"
|
||||||
ARG VERSION
|
ARG VERSION
|
||||||
FROM hunterlong/statup:base-v${VERSION}
|
ENV DEP_VERSION v0.5.0
|
||||||
|
RUN apk add --no-cache libstdc++ gcc g++ make git ca-certificates linux-headers wget curl jq
|
||||||
|
RUN curl -L -s https://github.com/golang/dep/releases/download/$DEP_VERSION/dep-linux-amd64 -o /go/bin/dep && \
|
||||||
|
chmod +x /go/bin/dep
|
||||||
|
RUN curl -L -s https://assets.statup.io/sass -o /usr/local/bin/sass && \
|
||||||
|
chmod +x /usr/local/bin/sass
|
||||||
|
WORKDIR /go/src/github.com/hunterlong/statup
|
||||||
|
ADD . /go/src/github.com/hunterlong/statup
|
||||||
|
RUN make dep
|
||||||
|
RUN make dev-deps
|
||||||
|
RUN make install
|
||||||
|
|
||||||
|
# Statup :latest Docker Image
|
||||||
|
FROM alpine:latest
|
||||||
MAINTAINER "Hunter Long (https://github.com/hunterlong)"
|
MAINTAINER "Hunter Long (https://github.com/hunterlong)"
|
||||||
|
|
||||||
RUN apk --no-cache add curl jq
|
ARG VERSION
|
||||||
ENV IS_DOCKER=true
|
ENV IS_DOCKER=true
|
||||||
ENV STATUP_DIR=/app
|
ENV STATUP_DIR=/app
|
||||||
|
|
||||||
|
RUN apk --no-cache add curl jq
|
||||||
|
|
||||||
|
COPY --from=base /usr/local/bin/sass /usr/local/bin/sass
|
||||||
|
COPY --from=base /go/bin/statup /usr/local/bin/statup
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
VOLUME /app
|
VOLUME /app
|
||||||
EXPOSE 8080
|
EXPOSE 8080
|
||||||
|
|
19
Makefile
19
Makefile
|
@ -31,10 +31,10 @@ travis-test: dev-deps cypress-install test coverage
|
||||||
build-all: build-mac build-linux build-windows build-alpine compress
|
build-all: build-mac build-linux build-windows build-alpine compress
|
||||||
|
|
||||||
# build all docker tags
|
# build all docker tags
|
||||||
docker-build-all: docker-build-base docker-build-dev docker-build-latest
|
docker-build-all: docker-build-dev docker-build-latest
|
||||||
|
|
||||||
# push all docker tags built
|
# push all docker tags built
|
||||||
docker-publish-all: docker-push-base docker-push-dev docker-push-latest
|
docker-publish-all: docker-push-dev docker-push-latest
|
||||||
|
|
||||||
# build Statup for local arch
|
# build Statup for local arch
|
||||||
build: compile
|
build: compile
|
||||||
|
@ -129,22 +129,15 @@ build-alpine: compile
|
||||||
#
|
#
|
||||||
|
|
||||||
# build :latest docker tag
|
# build :latest docker tag
|
||||||
docker-build-latest: docker-build-base
|
docker-build-latest:
|
||||||
docker build --build-arg VERSION=$(VERSION) -t hunterlong/statup:latest --no-cache -f Dockerfile .
|
docker build --build-arg VERSION=$(VERSION) -t hunterlong/statup:latest --no-cache -f Dockerfile .
|
||||||
docker tag hunterlong/statup:latest hunterlong/statup:latest-v$(VERSION)
|
docker tag hunterlong/statup:latest hunterlong/statup:v$(VERSION)
|
||||||
|
|
||||||
# build :dev docker tag
|
# build :dev docker tag
|
||||||
docker-build-dev: docker-build-base
|
docker-build-dev:
|
||||||
docker build --build-arg VERSION=$(VERSION) -t hunterlong/statup:dev --no-cache -f dev/Dockerfile-dev .
|
docker build --build-arg VERSION=$(VERSION) -t hunterlong/statup:dev --no-cache -f dev/Dockerfile-dev .
|
||||||
docker tag hunterlong/statup:dev hunterlong/statup:dev-v$(VERSION)
|
docker tag hunterlong/statup:dev hunterlong/statup:dev-v$(VERSION)
|
||||||
|
|
||||||
# build :base and base-v{VERSION} docker tag
|
|
||||||
docker-build-base: clean
|
|
||||||
wget -q https://assets.statup.io/sass && chmod +x sass
|
|
||||||
$(XGO) --targets=linux/amd64 -ldflags="-X main.VERSION=$(VERSION) -linkmode external -extldflags -static" -out alpine ./cmd
|
|
||||||
docker build -t hunterlong/statup:base --no-cache -f dev/Dockerfile-base .
|
|
||||||
docker tag hunterlong/statup:base hunterlong/statup:base-v$(VERSION)
|
|
||||||
|
|
||||||
# build Cypress UI testing :cypress docker tag
|
# build Cypress UI testing :cypress docker tag
|
||||||
docker-build-cypress: clean
|
docker-build-cypress: clean
|
||||||
GOPATH=$(GOPATH) xgo -out statup -go 1.10.x -ldflags "-X main.VERSION=$(VERSION) -X main.COMMIT=$(TRAVIS_COMMIT)" --targets=linux/amd64 ./cmd
|
GOPATH=$(GOPATH) xgo -out statup -go 1.10.x -ldflags "-X main.VERSION=$(VERSION) -X main.COMMIT=$(TRAVIS_COMMIT)" --targets=linux/amd64 ./cmd
|
||||||
|
@ -181,7 +174,7 @@ docker-push-cypress:
|
||||||
# push the :latest tag to Docker hub
|
# push the :latest tag to Docker hub
|
||||||
docker-push-latest:
|
docker-push-latest:
|
||||||
docker push hunterlong/statup:latest
|
docker push hunterlong/statup:latest
|
||||||
docker push hunterlong/statup:latest-v$(VERSION)
|
docker push hunterlong/statup:v$(VERSION)
|
||||||
|
|
||||||
docker-run-mssql:
|
docker-run-mssql:
|
||||||
docker run -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=PaSsW0rD123' -p 1433:1433 -d microsoft/mssql-server-linux
|
docker run -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=PaSsW0rD123' -p 1433:1433 -d microsoft/mssql-server-linux
|
||||||
|
|
Loading…
Reference in New Issue