From 7175f7d8cd3dec358bcd553aebbe08b3f8e0375e Mon Sep 17 00:00:00 2001 From: Shane Hughes Date: Wed, 4 Oct 2023 12:27:37 +0000 Subject: [PATCH] adding dockerfile --- Dockerfile | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..4d96587 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,23 @@ +# Alpine version for the runner contianer +ARG ALPINE_VERSION=latest + +# golang builder image +FROM golang:1.21-bullseye AS builder +WORKDIR /build +COPY . . +RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -buildvcs=false -pgo=auto -ldflags="-w -s -X 'main.Version=$(git describe --tags)'" -o app . \ + && git clone https://github.com/andybalholm/redwood-config.git /tmp/redwood-config + +# Final runner image +FROM alpine:${ALPINE_VERSION} AS runner + +# Copy in config & app binary +COPY --from=builder /build/app /app +COPY --from=builder /tmp/redwood-config /etc/redwood +RUN mkdir -p /var/log/redwood + +# Expose the default ports from redwood-config +EXPOSE 6502 6510 + +# Run the app +ENTRYPOINT [ "/app" ] \ No newline at end of file