fix s6-overlay overwriting bin symlinks:

https://github.com/just-containers/s6-overlay/tree/v2.1.0.1#bin-and-sbin-are-symlinks

adding a makefile to build docker images locally.
pull/276/head^2
Jason Kulatunga 2 years ago
parent 6e02e4da02
commit ca7772250c

@ -38,5 +38,17 @@ windows/amd64:
@echo "building collector binary (OS = $(OS), ARCH = $(ARCH))" @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/ 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: # clean:
# rm scrutiny-collector-metrics-* scrutiny-web-* # rm scrutiny-collector-metrics-* scrutiny-web-*

@ -33,7 +33,6 @@ 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
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y cron smartmontools ca-certificates curl tzdata \ RUN apt-get update && apt-get install -y cron smartmontools ca-certificates curl tzdata \
&& update-ca-certificates \ && update-ca-certificates \
&& case ${TARGETARCH} in \ && case ${TARGETARCH} in \
@ -41,11 +40,11 @@ RUN apt-get update && apt-get install -y cron smartmontools ca-certificates curl
"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/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 \ && 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 \ && 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 || true \ && dpkg -i --force-all /tmp/influxdb2-2.2.0-${TARGETARCH}.deb
&& rm -rf /tmp/influxdb2-2.2.0-${TARGETARCH}.deb
COPY /rootfs / COPY /rootfs /

@ -13,7 +13,7 @@ RUN go mod vendor && \
FROM ubuntu:latest as runtime FROM ubuntu:latest as runtime
WORKDIR /scrutiny WORKDIR /scrutiny
ENV PATH="/opt/scrutiny/bin:${PATH}" 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 RUN apt-get update && apt-get install -y cron smartmontools ca-certificates tzdata && update-ca-certificates
COPY /docker/entrypoint-collector.sh /entrypoint-collector.sh COPY /docker/entrypoint-collector.sh /entrypoint-collector.sh

@ -28,7 +28,7 @@ FROM ubuntu:latest as runtime
EXPOSE 8080 EXPOSE 8080
WORKDIR /opt/scrutiny WORKDIR /opt/scrutiny
ENV PATH="/opt/scrutiny/bin:${PATH}" 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 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=backendbuild /go/src/github.com/analogj/scrutiny/scrutiny /opt/scrutiny/bin/

Loading…
Cancel
Save