|
|
|
########
|
|
|
|
FROM golang:1.17.10-buster as backendbuild
|
|
|
|
|
|
|
|
WORKDIR /go/src/github.com/analogj/scrutiny
|
|
|
|
|
|
|
|
COPY . /go/src/github.com/analogj/scrutiny
|
|
|
|
|
|
|
|
RUN go mod vendor && \
|
|
|
|
go build -ldflags '-w -extldflags "-static"' -o scrutiny webapp/backend/cmd/scrutiny/scrutiny.go
|
|
|
|
|
|
|
|
########
|
|
|
|
FROM node:lts-slim as frontendbuild
|
|
|
|
|
|
|
|
#reduce logging, disable angular-cli analytics for ci environment
|
|
|
|
ENV NPM_CONFIG_LOGLEVEL=warn NG_CLI_ANALYTICS=false
|
|
|
|
|
|
|
|
WORKDIR /opt/scrutiny/src
|
|
|
|
COPY webapp/frontend /opt/scrutiny/src
|
|
|
|
|
|
|
|
RUN npm install -g @angular/cli@9.1.4 && \
|
|
|
|
mkdir -p /opt/scrutiny/dist && \
|
|
|
|
npm install && \
|
|
|
|
npm run build:prod -- --output-path=/opt/scrutiny/dist
|
|
|
|
|
|
|
|
|
|
|
|
########
|
|
|
|
FROM ubuntu:latest as runtime
|
|
|
|
EXPOSE 8080
|
|
|
|
WORKDIR /opt/scrutiny
|
|
|
|
ENV PATH="/opt/scrutiny/bin:${PATH}"
|
|
|
|
ARG DEBIAN_FRONTEND=noninteractive
|
|
|
|
RUN apt-get update && apt-get install -y ca-certificates curl tzdata && update-ca-certificates
|
|
|
|
|
|
|
|
COPY --from=backendbuild /go/src/github.com/analogj/scrutiny/scrutiny /opt/scrutiny/bin/
|
|
|
|
COPY --from=frontendbuild /opt/scrutiny/dist /opt/scrutiny/web
|
|
|
|
RUN chmod +x /opt/scrutiny/bin/scrutiny && \
|
|
|
|
mkdir -p /opt/scrutiny/web && \
|
|
|
|
mkdir -p /opt/scrutiny/config && \
|
|
|
|
chmod -R ugo+rwx /opt/scrutiny/config
|
|
|
|
CMD ["/opt/scrutiny/bin/scrutiny", "start"]
|