From 7976271a4d1d49d55616bae67d5dc2fb59e5ed9b Mon Sep 17 00:00:00 2001 From: Reinaldy Rafli Date: Mon, 8 May 2023 16:48:09 +0700 Subject: [PATCH] feat: docker support (#3) --------- Co-authored-by: Anton Ovchinnikov --- Dockerfile | 14 ++++++++++++++ docker-entrypoint.sh | 10 ++++++++++ 2 files changed, 24 insertions(+) create mode 100644 Dockerfile create mode 100644 docker-entrypoint.sh 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