@@ -74,13 +74,6 @@ jobs:
|
|||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
- name: "Populate frontend version information"
|
- name: "Populate frontend version information"
|
||||||
run: "cd webapp/frontend && ./git.version.sh"
|
run: "cd webapp/frontend && ./git.version.sh"
|
||||||
- name: "Install Node"
|
|
||||||
uses: actions/setup-node@v3
|
|
||||||
with:
|
|
||||||
node-version: 16
|
|
||||||
- name: "Generate frontend"
|
|
||||||
run: |
|
|
||||||
make binary-frontend && echo "print contents of ./dist" && ls -alt ./dist
|
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v2
|
uses: docker/setup-qemu-action@v2
|
||||||
with:
|
with:
|
||||||
@@ -132,13 +125,6 @@ jobs:
|
|||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
- name: "Populate frontend version information"
|
- name: "Populate frontend version information"
|
||||||
run: "cd webapp/frontend && ./git.version.sh"
|
run: "cd webapp/frontend && ./git.version.sh"
|
||||||
- name: "Install Node"
|
|
||||||
uses: actions/setup-node@v3
|
|
||||||
with:
|
|
||||||
node-version: 16
|
|
||||||
- name: "Generate frontend"
|
|
||||||
run: |
|
|
||||||
make binary-frontend && echo "print contents of ./dist" && ls -alt ./dist
|
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v2
|
uses: docker/setup-qemu-action@v2
|
||||||
with:
|
with:
|
||||||
|
|||||||
@@ -19,13 +19,6 @@ jobs:
|
|||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
- name: "Populate frontend version information"
|
- name: "Populate frontend version information"
|
||||||
run: "cd webapp/frontend && ./git.version.sh"
|
run: "cd webapp/frontend && ./git.version.sh"
|
||||||
- name: "Install Node"
|
|
||||||
uses: actions/setup-node@v3
|
|
||||||
with:
|
|
||||||
node-version: 16
|
|
||||||
- name: "Generate frontend"
|
|
||||||
run: |
|
|
||||||
make binary-frontend && echo "print contents of ./dist" && ls -alt ./dist
|
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v2
|
uses: docker/setup-qemu-action@v2
|
||||||
with:
|
with:
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ binary-frontend: export NPM_CONFIG_LOGLEVEL = warn
|
|||||||
binary-frontend: export NG_CLI_ANALYTICS = false
|
binary-frontend: export NG_CLI_ANALYTICS = false
|
||||||
binary-frontend:
|
binary-frontend:
|
||||||
cd webapp/frontend
|
cd webapp/frontend
|
||||||
npm install -g @angular/cli@9.1.4
|
npm install -g @angular/cli@v13-lts
|
||||||
mkdir -p $(CURDIR)/dist
|
mkdir -p $(CURDIR)/dist
|
||||||
npm ci
|
npm ci
|
||||||
npm run build:prod -- --output-path=$(CURDIR)/dist
|
npm run build:prod -- --output-path=$(CURDIR)/dist
|
||||||
|
|||||||
+28
-15
@@ -1,51 +1,64 @@
|
|||||||
|
# syntax=docker/dockerfile:1.4
|
||||||
########################################################################################################################
|
########################################################################################################################
|
||||||
# Omnibus Image
|
# Omnibus Image
|
||||||
# NOTE: this image requires the `make binary-frontend` target to have been run before `docker build` The `dist` directory must exist.
|
|
||||||
########################################################################################################################
|
########################################################################################################################
|
||||||
|
|
||||||
|
######## Build the frontend
|
||||||
|
FROM --platform=${BUILDPLATFORM} node AS frontendbuild
|
||||||
|
WORKDIR /go/src/github.com/analogj/scrutiny
|
||||||
|
COPY --link . /go/src/github.com/analogj/scrutiny
|
||||||
|
|
||||||
########
|
RUN make binary-frontend
|
||||||
|
|
||||||
|
|
||||||
|
######## Build the backend
|
||||||
FROM golang:1.20-bullseye as backendbuild
|
FROM golang:1.20-bullseye as backendbuild
|
||||||
|
|
||||||
WORKDIR /go/src/github.com/analogj/scrutiny
|
WORKDIR /go/src/github.com/analogj/scrutiny
|
||||||
COPY . /go/src/github.com/analogj/scrutiny
|
COPY --link . /go/src/github.com/analogj/scrutiny
|
||||||
RUN make binary-clean binary-all WEB_BINARY_NAME=scrutiny
|
RUN make binary-clean binary-all WEB_BINARY_NAME=scrutiny
|
||||||
|
|
||||||
|
|
||||||
########
|
######## Combine build artifacts in runtime image
|
||||||
FROM debian:bullseye-slim as runtime
|
FROM debian:bullseye-slim as runtime
|
||||||
ARG TARGETARCH
|
ARG TARGETARCH
|
||||||
EXPOSE 8080
|
EXPOSE 8080
|
||||||
WORKDIR /opt/scrutiny
|
WORKDIR /opt/scrutiny
|
||||||
ENV PATH="/opt/scrutiny/bin:${PATH}"
|
ENV PATH="/opt/scrutiny/bin:${PATH}"
|
||||||
ENV INFLUXD_CONFIG_PATH=/opt/scrutiny/influxdb
|
ENV INFLUXD_CONFIG_PATH=/opt/scrutiny/influxdb
|
||||||
|
ENV S6VER="1.21.8.0"
|
||||||
|
ENV INFLUXVER="2.2.0"
|
||||||
|
|
||||||
RUN apt-get update && apt-get install -y cron smartmontools ca-certificates curl tzdata \
|
RUN apt-get update && DEBIAN_FRONTEND=noninteractive \
|
||||||
|
apt-get install -y --no-install-recommends \
|
||||||
|
ca-certificates \
|
||||||
|
cron \
|
||||||
|
curl \
|
||||||
|
smartmontools \
|
||||||
|
tzdata \
|
||||||
&& update-ca-certificates \
|
&& update-ca-certificates \
|
||||||
&& case ${TARGETARCH} in \
|
&& case ${TARGETARCH} in \
|
||||||
"amd64") S6_ARCH=amd64 ;; \
|
"amd64") S6_ARCH=amd64 ;; \
|
||||||
"arm64") S6_ARCH=aarch64 ;; \
|
"arm64") S6_ARCH=aarch64 ;; \
|
||||||
esac \
|
esac \
|
||||||
&& curl https://github.com/just-containers/s6-overlay/releases/download/v1.21.8.0/s6-overlay-${S6_ARCH}.tar.gz -L -s --output /tmp/s6-overlay-${S6_ARCH}.tar.gz \
|
&& curl https://github.com/just-containers/s6-overlay/releases/download/v${S6VER}/s6-overlay-${S6_ARCH}.tar.gz -L -s --output /tmp/s6-overlay-${S6_ARCH}.tar.gz \
|
||||||
&& tar xzf /tmp/s6-overlay-${S6_ARCH}.tar.gz -C / \
|
&& tar xzf /tmp/s6-overlay-${S6_ARCH}.tar.gz -C / \
|
||||||
&& rm -rf /tmp/s6-overlay-${S6_ARCH}.tar.gz \
|
&& rm -rf /tmp/s6-overlay-${S6_ARCH}.tar.gz \
|
||||||
&& curl -L https://dl.influxdata.com/influxdb/releases/influxdb2-2.2.0-${TARGETARCH}.deb --output /tmp/influxdb2-2.2.0-${TARGETARCH}.deb \
|
&& curl -L https://dl.influxdata.com/influxdb/releases/influxdb2-${INFLUXVER}-${TARGETARCH}.deb --output /tmp/influxdb2-${INFLUXVER}-${TARGETARCH}.deb \
|
||||||
&& dpkg -i --force-all /tmp/influxdb2-2.2.0-${TARGETARCH}.deb \
|
&& dpkg -i --force-all /tmp/influxdb2-${INFLUXVER}-${TARGETARCH}.deb \
|
||||||
&& rm -rf /tmp/influxdb2-2.2.0-${TARGETARCH}.deb
|
&& rm -rf /tmp/influxdb2-2.2.0-${TARGETARCH}.deb
|
||||||
|
|
||||||
COPY /rootfs /
|
COPY /rootfs /
|
||||||
|
|
||||||
COPY /rootfs/etc/cron.d/scrutiny /etc/cron.d/scrutiny
|
COPY --link --from=backendbuild --chmod=755 /go/src/github.com/analogj/scrutiny/scrutiny /opt/scrutiny/bin/
|
||||||
COPY --from=backendbuild /go/src/github.com/analogj/scrutiny/scrutiny /opt/scrutiny/bin/
|
COPY --link --from=backendbuild --chmod=755 /go/src/github.com/analogj/scrutiny/scrutiny-collector-metrics /opt/scrutiny/bin/
|
||||||
COPY --from=backendbuild /go/src/github.com/analogj/scrutiny/scrutiny-collector-metrics /opt/scrutiny/bin/
|
COPY --link --from=frontendbuild --chmod=644 /go/src/github.com/analogj/scrutiny/dist /opt/scrutiny/web
|
||||||
|
|
||||||
COPY dist /opt/scrutiny/web
|
COPY dist /opt/scrutiny/web
|
||||||
RUN chmod +x /opt/scrutiny/bin/scrutiny && \
|
RUN chmod 0644 /etc/cron.d/scrutiny && \
|
||||||
chmod +x /opt/scrutiny/bin/scrutiny-collector-metrics && \
|
|
||||||
chmod 0644 /etc/cron.d/scrutiny && \
|
|
||||||
rm -f /etc/cron.daily/* && \
|
rm -f /etc/cron.daily/* && \
|
||||||
mkdir -p /opt/scrutiny/web && \
|
mkdir -p /opt/scrutiny/web && \
|
||||||
mkdir -p /opt/scrutiny/config && \
|
mkdir -p /opt/scrutiny/config && \
|
||||||
chmod -R ugo+rwx /opt/scrutiny/config
|
chmod -R ugo+rwx /opt/scrutiny/config
|
||||||
|
|
||||||
|
|
||||||
CMD ["/init"]
|
CMD ["/init"]
|
||||||
|
|||||||
+13
-9
@@ -1,20 +1,25 @@
|
|||||||
|
# syntax=docker/dockerfile:1.4
|
||||||
########################################################################################################################
|
########################################################################################################################
|
||||||
# Web Image
|
# Web Image
|
||||||
# NOTE: this image requires the `make binary-frontend` target to have been run before `docker build` The `dist` directory must exist.
|
|
||||||
########################################################################################################################
|
########################################################################################################################
|
||||||
|
|
||||||
|
######## Build the frontend
|
||||||
|
FROM --platform=${BUILDPLATFORM} node AS frontendbuild
|
||||||
|
WORKDIR /go/src/github.com/analogj/scrutiny
|
||||||
|
COPY --link . /go/src/github.com/analogj/scrutiny
|
||||||
|
|
||||||
########
|
RUN make binary-frontend
|
||||||
|
|
||||||
|
######## Build the backend
|
||||||
FROM golang:1.20-bullseye as backendbuild
|
FROM golang:1.20-bullseye as backendbuild
|
||||||
|
|
||||||
WORKDIR /go/src/github.com/analogj/scrutiny
|
WORKDIR /go/src/github.com/analogj/scrutiny
|
||||||
|
COPY --link . /go/src/github.com/analogj/scrutiny
|
||||||
COPY . /go/src/github.com/analogj/scrutiny
|
|
||||||
|
|
||||||
RUN make binary-clean binary-all WEB_BINARY_NAME=scrutiny
|
RUN make binary-clean binary-all WEB_BINARY_NAME=scrutiny
|
||||||
|
|
||||||
|
|
||||||
########
|
######## Combine build artifacts in runtime image
|
||||||
FROM debian:bullseye-slim as runtime
|
FROM debian:bullseye-slim as runtime
|
||||||
EXPOSE 8080
|
EXPOSE 8080
|
||||||
WORKDIR /opt/scrutiny
|
WORKDIR /opt/scrutiny
|
||||||
@@ -22,10 +27,9 @@ ENV PATH="/opt/scrutiny/bin:${PATH}"
|
|||||||
|
|
||||||
RUN apt-get update && apt-get install -y ca-certificates curl tzdata && update-ca-certificates
|
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 --link --from=backendbuild --chmod=755 /go/src/github.com/analogj/scrutiny/scrutiny /opt/scrutiny/bin/
|
||||||
COPY dist /opt/scrutiny/web
|
COPY --link --from=frontendbuild --chmod=644 /go/src/github.com/analogj/scrutiny/dist /opt/scrutiny/web
|
||||||
RUN chmod +x /opt/scrutiny/bin/scrutiny && \
|
RUN mkdir -p /opt/scrutiny/web && \
|
||||||
mkdir -p /opt/scrutiny/web && \
|
|
||||||
mkdir -p /opt/scrutiny/config && \
|
mkdir -p /opt/scrutiny/config && \
|
||||||
chmod -R ugo+rwx /opt/scrutiny/config
|
chmod -R ugo+rwx /opt/scrutiny/config
|
||||||
CMD ["/opt/scrutiny/bin/scrutiny", "start"]
|
CMD ["/opt/scrutiny/bin/scrutiny", "start"]
|
||||||
|
|||||||
Reference in New Issue
Block a user