mirror of https://github.com/statping/statping
docker buildx
parent
62560f947e
commit
482c32fe11
|
@ -326,6 +326,15 @@ jobs:
|
|||
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
|
||||
run: echo "${DOCKER_PASSWORD}" | docker login --username "${DOCKER_USERNAME}" --password-stdin
|
||||
|
||||
- name: Cache Docker layers
|
||||
uses: actions/cache@v2
|
||||
id: cache
|
||||
with:
|
||||
path: /tmp/.buildx-cache
|
||||
key: ${{ runner.os }}-buildx-${{ github.sha }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-buildx-
|
||||
|
||||
- name: Docker Build :base
|
||||
run: make buildx-base
|
||||
|
||||
|
|
|
@ -426,6 +426,15 @@ jobs:
|
|||
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
|
||||
run: echo "${DOCKER_PASSWORD}" | docker login --username "${DOCKER_USERNAME}" --password-stdin
|
||||
|
||||
- name: Cache Docker layers
|
||||
uses: actions/cache@v2
|
||||
id: cache
|
||||
with:
|
||||
path: /tmp/.buildx-cache
|
||||
key: ${{ runner.os }}-buildx-${{ github.sha }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-buildx-
|
||||
|
||||
- name: Docker Build :base
|
||||
run: make buildx-base
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ FROM golang:1.14-alpine AS backend
|
|||
LABEL maintainer="Hunter Long (https://github.com/hunterlong)"
|
||||
ARG VERSION
|
||||
ARG BUILDPLATFORM
|
||||
ARG TARGETARCH
|
||||
RUN apk add --update --no-cache libstdc++ gcc g++ make git ca-certificates linux-headers wget curl jq && \
|
||||
update-ca-certificates
|
||||
RUN curl -L -s https://assets.statping.com/sass -o /usr/local/bin/sass && \
|
||||
|
@ -23,6 +24,7 @@ WORKDIR /go/src/github.com/statping/statping
|
|||
ADD go.mod go.sum ./
|
||||
RUN go mod download
|
||||
ENV GO111MODULE on
|
||||
ENV CGO_ENABLED 1
|
||||
RUN go get github.com/stretchr/testify/assert && \
|
||||
go get github.com/stretchr/testify/require && \
|
||||
go get github.com/GeertJohan/go.rice/rice && \
|
||||
|
@ -30,7 +32,8 @@ RUN go get github.com/stretchr/testify/assert && \
|
|||
go get github.com/crazy-max/xgo
|
||||
COPY . .
|
||||
COPY --from=frontend /statping/dist/ ./source/dist/
|
||||
RUN make clean frontend-copy generate embed build
|
||||
RUN make clean frontend-copy generate embed
|
||||
RUN GOOS=linux GOARCH=$TARGETARCH go build -a -ldflags "-s -w -extldflags -static -X main.VERSION=${VERSION}" -o statping --tags "netgo linux" ./cmd
|
||||
RUN chmod a+x statping && mv statping /go/bin/statping
|
||||
# /go/bin/statping - statping binary
|
||||
# /usr/local/bin/sass - sass binary
|
||||
|
|
6
Makefile
6
Makefile
|
@ -335,19 +335,19 @@ certs:
|
|||
buildx-latest: multiarch
|
||||
docker buildx create --name statping-latest
|
||||
docker buildx inspect --builder statping-latest --bootstrap
|
||||
docker buildx build --builder statping-latest --pull --push --platform linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6 -f Dockerfile -t statping/statping:latest -t statping/statping:v${VERSION} --build-arg=VERSION=${VERSION} .
|
||||
docker buildx build --builder statping-latest --cache-from "type=local,src=/tmp/.buildx-cache" --cache-to "type=local,dest=/tmp/.buildx-cache" --pull --push --platform linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6 -f Dockerfile -t statping/statping:latest -t statping/statping:v${VERSION} --build-arg=VERSION=${VERSION} .
|
||||
docker buildx rm statping-latest
|
||||
|
||||
buildx-dev: multiarch
|
||||
docker buildx create --name statping-dev
|
||||
docker buildx inspect --builder statping-dev --bootstrap
|
||||
docker buildx build --builder statping-dev --pull --push --platform linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6 -f Dockerfile -t statping/statping:dev --build-arg=VERSION=${VERSION} .
|
||||
docker buildx build --builder statping-dev --cache-from "type=local,src=/tmp/.buildx-cache" --cache-to "type=local,dest=/tmp/.buildx-cache" --pull --push --platform linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6 -f Dockerfile -t statping/statping:dev --build-arg=VERSION=${VERSION} .
|
||||
docker buildx rm statping-dev
|
||||
|
||||
buildx-base: multiarch
|
||||
docker buildx create --name statping-base
|
||||
docker buildx inspect --builder statping-base --bootstrap
|
||||
docker buildx build --builder statping-base --pull --push --platform linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6 -f Dockerfile.base -t statping/statping:base --build-arg=VERSION=${VERSION} .
|
||||
docker buildx build --builder statping-base --cache-from "type=local,src=/tmp/.buildx-cache" --cache-to "type=local,dest=/tmp/.buildx-cache" --pull --push --platform linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6 -f Dockerfile.base -t statping/statping:base --build-arg=VERSION=${VERSION} .
|
||||
docker buildx rm statping-base
|
||||
|
||||
multiarch:
|
||||
|
|
Loading…
Reference in New Issue