ARG GOLANG_TAG=193044292705.dkr.ecr.ap-south-1.amazonaws.com/common/golang:1.23.8 # To run locally, use #ARG GOLANG_TAG=registry.cmd.navi-tech.in/common/golang:1.22.12 FROM ${GOLANG_TAG} as builder RUN mkdir -p /build/collector RUN mkdir -p /root/.ssh && echo "Host *\n StrictHostKeyChecking no" > ~/.ssh/config && chmod 0400 /root/.ssh ARG SSH_KEY RUN echo "${SSH_KEY}" > /root/.ssh/id_rsa \ && chmod 0600 /root/.ssh/id_rsa \ && git config --global url."git@github.com:".insteadOf "https://github.com/" \ && go env -w GOPRIVATE='github.com/navi-*' WORKDIR /build/collector/ COPY . /build/collector/ RUN /bin/bash -c "make build-collector" FROM ${GOLANG_TAG} RUN mkdir -p /usr/local WORKDIR /usr/local RUN mkdir -p alfredTmp COPY --from=0 /build/collector/alfred-collector /usr/local/ COPY --from=0 /build/collector/config/application-collector.properties /usr/local/config/ COPY --from=0 /build/collector/config/elasticapm-collector.properties /usr/local/config/ RUN adduser --system --uid 4000 --disabled-password app-user && chown -R 4000:4000 /usr/local && chmod -R g+w /usr/local/ USER 4000 CMD /bin/bash -c "./alfred-collector"