statping/Dockerfile.base

46 lines
1.6 KiB
Docker
Raw Permalink Normal View History

2020-07-22 20:19:25 +00:00
FROM node:12.18.2-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
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-08-07 03:18:45 +00:00
ARG COMMIT
2020-07-12 20:39:51 +00:00
ARG BUILDPLATFORM
2020-07-14 08:38:02 +00:00
ARG TARGETARCH
2020-07-23 04:15:55 +00:00
RUN apk add --update --no-cache libstdc++ gcc g++ make git autoconf \
libtool ca-certificates linux-headers wget curl jq && \
2020-03-19 20:51:30 +00:00
update-ca-certificates
2020-07-23 04:15:55 +00:00
2020-08-21 21:33:40 +00:00
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
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-08-07 22:46:34 +00:00
RUN make clean generate embed
2020-08-07 03:18:45 +00:00
RUN go build -a -ldflags "-s -w -extldflags -static -X main.VERSION=${VERSION} -X main.COMMIT=${COMMIT}" -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
2020-08-21 21:33:40 +00:00
# /root/sassc/bin/sassc - sass binary
2020-03-13 04:06:06 +00:00
# /statping - Vue frontend (from frontend)