diff --git a/Makefile b/Makefile index 360fa8f..a721ed7 100644 --- a/Makefile +++ b/Makefile @@ -38,5 +38,17 @@ windows/amd64: @echo "building collector binary (OS = $(OS), ARCH = $(ARCH))" xgo -v --targets="$(OS)/$(ARCH)" -ldflags "-extldflags=-static -X main.goos=$(OS) -X main.goarch=$(ARCH)" -out scrutiny-collector-metrics -tags "static netgo" ${GO_WORKSPACE}/collector/cmd/collector-metrics/ + +docker-collector: + @echo "building collector docker image" + docker build --build-arg TARGETARCH=amd64 -f docker/Dockerfile.collector -t analogj/scrutiny-dev:collector . + +docker-web: + @echo "building web docker image" + docker build --build-arg TARGETARCH=amd64 -f docker/Dockerfile.web -t analogj/scrutiny-dev:web . + +docker-omnibus: + @echo "building omnibus docker image" + docker build --build-arg TARGETARCH=amd64 -f docker/Dockerfile -t analogj/scrutiny-dev:omnibus . # clean: # rm scrutiny-collector-metrics-* scrutiny-web-* diff --git a/docker/Dockerfile b/docker/Dockerfile index 3e5527f..19fb17e 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -33,7 +33,6 @@ WORKDIR /opt/scrutiny ENV PATH="/opt/scrutiny/bin:${PATH}" ENV INFLUXD_CONFIG_PATH=/opt/scrutiny/influxdb -ARG DEBIAN_FRONTEND=noninteractive RUN apt-get update && apt-get install -y cron smartmontools ca-certificates curl tzdata \ && update-ca-certificates \ && case ${TARGETARCH} in \ @@ -41,11 +40,11 @@ RUN apt-get update && apt-get install -y cron smartmontools ca-certificates curl "arm64") S6_ARCH=aarch64 ;; \ 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 \ - && tar xzf /tmp/s6-overlay-${S6_ARCH}.tar.gz -C / \ + && tar xzf /tmp/s6-overlay-${S6_ARCH}.tar.gz -C / --exclude="./bin" \ + && tar xzf /tmp/s6-overlay-${S6_ARCH}.tar.gz -C /usr ./bin \ && rm -rf /tmp/s6-overlay-${S6_ARCH}.tar.gz \ - && curl https://dl.influxdata.com/influxdb/releases/influxdb2-2.2.0-${TARGETARCH}.deb -L -s --output /tmp/influxdb2-2.2.0-${TARGETARCH}.deb \ - && dpkg -i --force-all /tmp/influxdb2-2.2.0-${TARGETARCH}.deb || true \ - && rm -rf /tmp/influxdb2-2.2.0-${TARGETARCH}.deb + && curl -L https://dl.influxdata.com/influxdb/releases/influxdb2-2.2.0-${TARGETARCH}.deb --output /tmp/influxdb2-2.2.0-${TARGETARCH}.deb \ + && dpkg -i --force-all /tmp/influxdb2-2.2.0-${TARGETARCH}.deb COPY /rootfs / diff --git a/docker/Dockerfile.collector b/docker/Dockerfile.collector index 7f8838c..4c1dc8e 100644 --- a/docker/Dockerfile.collector +++ b/docker/Dockerfile.collector @@ -13,7 +13,7 @@ RUN go mod vendor && \ FROM ubuntu:latest as runtime WORKDIR /scrutiny ENV PATH="/opt/scrutiny/bin:${PATH}" -ARG DEBIAN_FRONTEND=noninteractive + RUN apt-get update && apt-get install -y cron smartmontools ca-certificates tzdata && update-ca-certificates COPY /docker/entrypoint-collector.sh /entrypoint-collector.sh diff --git a/docker/Dockerfile.web b/docker/Dockerfile.web index 8495b1e..2ff577c 100644 --- a/docker/Dockerfile.web +++ b/docker/Dockerfile.web @@ -28,7 +28,7 @@ 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/