contentserver/Dockerfile
Stefan Martinov 0e44ca809d
Deterministic Log Messaging & Refactoring (#26)
* feat: remove apex log from dependency list & upgrade deps

* chore: remove commented out code

* chore: remove high cardinality metric labels

* chore: add stack trace to failed repo requests

* chore: remove logging and return error instead

* chore: change log messages for contentserver

* chore: add constistent messages to content update routine

* feat: add runtime id, and multierr validator

* chore: rename history

* chore: golint fixes

* chore: simplify (golinter)

* chore: update go version

* chore: remove unused dependencies for new go

* chore: move content update to else statement

* chore: remove go-spew

* chore: bump go version to 1.18

* chore: remove alpine dep for updated deps

* chore: update go version and improve build

* chore: minor reformatting
2022-05-26 15:09:11 +02:00

40 lines
906 B
Docker

##############################
###### STAGE: BUILD ######
##############################
FROM golang:1.18 AS build-env
WORKDIR /src
COPY ./go.mod ./go.sum ./
RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/go/pkg/mod \
go mod download -x
COPY ./ ./
RUN GOARCH=amd64 GOOS=linux CGO_ENABLED=0 go build -trimpath -o /contentserver
##############################
###### STAGE: PACKAGE ######
##############################
FROM alpine
ENV CONTENT_SERVER_ADDR=0.0.0.0:80
ENV CONTENT_SERVER_VAR_DIR=/var/lib/contentserver
ENV LOG_JSON=1
RUN apk add --update --no-cache ca-certificates curl bash && rm -rf /var/cache/apk/*
COPY --from=build-env /contentserver /usr/sbin/contentserver
VOLUME $CONTENT_SERVER_VAR_DIR
ENTRYPOINT ["/usr/sbin/contentserver"]
CMD ["-address=$CONTENT_SERVER_ADDR", "-var-dir=$CONTENT_SERVER_VAR_DIR"]
EXPOSE 80
EXPOSE 9200