mirror of https://github.com/statping/statping
60 lines
2.0 KiB
Docker
60 lines
2.0 KiB
Docker
FROM node:16.17.0 AS frontend
|
|
LABEL maintainer="Hunter Long (https://github.com/hunterlong)"
|
|
ARG BUILDPLATFORM
|
|
ARG GITHUB_ACCESS_TOKEN
|
|
ENV GITHUB_ACCESS_TOKEN ${GITHUB_ACCESS_TOKEN}
|
|
# Build vue frontent
|
|
WORKDIR /statping
|
|
COPY ./frontend/package.json .
|
|
COPY ./frontend/yarn.lock .
|
|
RUN yarn install --pure-lockfile --network-timeout 1000000
|
|
COPY ./frontend/ .
|
|
RUN yarn build && yarn cache clean
|
|
|
|
# Build react frontent
|
|
WORKDIR /statping-react
|
|
COPY ./react-frontend/package.json .
|
|
COPY ./react-frontend/yarn.lock .
|
|
COPY ./react-frontend/.npmrc .
|
|
RUN yarn install --pure-lockfile --network-timeout 1000000
|
|
COPY ./react-frontend/ .
|
|
RUN yarn build && yarn cache clean
|
|
|
|
|
|
# Statping Golang BACKEND building from source
|
|
# Creates "/go/bin/statping" and "/usr/local/bin/sass" for copying
|
|
FROM golang:1.18-alpine AS backend
|
|
LABEL maintainer="Hunter Long (https://github.com/hunterlong)"
|
|
ARG VERSION
|
|
ARG COMMIT
|
|
ARG BUILDPLATFORM
|
|
ARG TARGETARCH
|
|
RUN apk add --update --no-cache libstdc++ gcc g++ make git autoconf \
|
|
libtool ca-certificates linux-headers wget curl jq && \
|
|
update-ca-certificates
|
|
|
|
WORKDIR /root
|
|
RUN git clone https://github.com/sass/sassc.git
|
|
RUN . sassc/script/bootstrap && make -C sassc -j4
|
|
# sassc binary: /root/sassc/bin/sassc
|
|
|
|
WORKDIR /go/src/github.com/razorpay/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 install github.com/GeertJohan/go.rice/rice@latest && \
|
|
go get github.com/cortesi/modd/cmd/modd && \
|
|
go get github.com/crazy-max/xgo
|
|
COPY . .
|
|
COPY --from=frontend /statping/dist/ ./source/dist/
|
|
COPY --from=frontend /statping-react/build/ ./react/build/
|
|
RUN make clean generate embed
|
|
|
|
RUN go build -a -ldflags "-s -w -extldflags -static -X main.VERSION=${VERSION} -X main.COMMIT=${COMMIT}" -o statping --tags "netgo linux" ./cmd
|
|
RUN chmod a+x statping && mv statping /go/bin/statping
|
|
# /go/bin/statping - statping binary
|
|
# /root/sassc/bin/sassc - sass binary
|
|
# /statping - Vue frontend (from frontend) |