diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..d285860 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,14 @@ +ARG GOVERSION=latest +FROM golang:$GOVERSION AS builder + +WORKDIR /src +COPY . . + +RUN GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o . -ldflags="-s -w" . + +FROM alpine:3 + +RUN apk add --no-cache ca-certificates tzdata +COPY ./docker-entrypoint.sh / +COPY --from=builder /src/sentlog /bin/sentlog +ENTRYPOINT ["/docker-entrypoint.sh"] \ No newline at end of file diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh new file mode 100644 index 0000000..a87a79c --- /dev/null +++ b/docker-entrypoint.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +# For compatibility with older entrypoints +if [ "${1}" == "sentlog" ]; then + shift +elif [ "${1}" == "sh" ] || [ "${1}" == "/bin/sh" ]; then + exec "$@" +fi + +exec /bin/sentlog "$@" \ No newline at end of file