statping/Dockerfile.base

41 lines
1.6 KiB
Docker
Raw Normal View History

2020-07-13 21:36:18 +00:00
FROM node:10.17.0-alpine AS frontend
2020-07-12 20:39:51 +00:00
LABEL maintainer="Hunter Long (https://github.com/hunterlong)"
ARG BUILDPLATFORM
2020-03-10 08:49:57 +00:00
RUN npm install yarn -g
WORKDIR /statping
COPY ./frontend/package.json .
COPY ./frontend/yarn.lock .
RUN yarn install --pure-lockfile --network-timeout 1000000
COPY ./frontend .
2020-03-13 04:06:06 +00:00
RUN yarn build && yarn cache clean
2020-03-10 08:49:57 +00:00
# Statping Golang BACKEND building from source
# Creates "/go/bin/statping" and "/usr/local/bin/sass" for copying
2020-07-13 21:36:18 +00:00
FROM golang:1.14-alpine AS backend
2020-02-27 10:04:27 +00:00
LABEL maintainer="Hunter Long (https://github.com/hunterlong)"
ARG VERSION
2020-07-12 20:39:51 +00:00
ARG BUILDPLATFORM
2020-07-14 08:38:02 +00:00
ARG TARGETARCH
2020-03-19 20:51:30 +00:00
RUN apk add --update --no-cache libstdc++ gcc g++ make git ca-certificates linux-headers wget curl jq && \
update-ca-certificates
2020-02-27 10:04:27 +00:00
RUN curl -L -s https://assets.statping.com/sass -o /usr/local/bin/sass && \
chmod +x /usr/local/bin/sass
2020-03-09 18:17:55 +00:00
WORKDIR /go/src/github.com/statping/statping
2020-02-29 15:00:08 +00:00
ADD go.mod go.sum ./
2020-02-27 10:04:27 +00:00
RUN go mod download
2020-02-29 15:00:08 +00:00
ENV GO111MODULE on
2020-07-14 08:38:02 +00:00
ENV CGO_ENABLED 1
2020-03-01 06:57:30 +00:00
RUN go get github.com/stretchr/testify/assert && \
go get github.com/stretchr/testify/require && \
2020-02-28 06:37:48 +00:00
go get github.com/GeertJohan/go.rice/rice && \
2020-02-29 23:36:31 +00:00
go get github.com/cortesi/modd/cmd/modd && \
go get github.com/crazy-max/xgo
2020-03-10 08:49:57 +00:00
COPY . .
2020-03-16 06:51:15 +00:00
COPY --from=frontend /statping/dist/ ./source/dist/
2020-07-14 08:38:02 +00:00
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
2020-02-27 10:04:27 +00:00
RUN chmod a+x statping && mv statping /go/bin/statping
2020-03-13 04:06:06 +00:00
# /go/bin/statping - statping binary
# /usr/local/bin/sass - sass binary
# /statping - Vue frontend (from frontend)