diff --git a/build/Dockerfile b/build/Dockerfile deleted file mode 100644 index 644e5451..00000000 --- a/build/Dockerfile +++ /dev/null @@ -1,20 +0,0 @@ -# Stage 0 -# Build the binaries -FROM golang:1.23-alpine -WORKDIR /app -COPY . . - -# Build all binaries -RUN go build -o ./bin/outpost ./cmd/outpost/main.go && \ - go build -o ./bin/outpost-server ./cmd/outpost-server/main.go && \ - go build -o ./bin/outpost-migrate-redis ./cmd/outpost-migrate-redis/main.go - -# Stage 1 -# Copy binaries to a new image -FROM scratch -COPY --from=0 /app/bin/outpost /bin/outpost -COPY --from=0 /app/bin/outpost-server /bin/outpost-server -COPY --from=0 /app/bin/outpost-migrate-redis /bin/outpost-migrate-redis - -# Default to running the server -ENTRYPOINT ["/bin/outpost", "serve"] diff --git a/build/Dockerfile.example b/build/Dockerfile.example new file mode 100644 index 00000000..869529e9 --- /dev/null +++ b/build/Dockerfile.example @@ -0,0 +1,46 @@ +# ⚠️ IMPORTANT: This Dockerfile is for REFERENCE ONLY and is NOT production-ready. +# +# We do NOT recommend using this Dockerfile in production. Instead, use the official +# hookdeck/outpost image from Docker Hub: +# docker pull hookdeck/outpost:latest +# +# The official image is optimized, regularly updated, and fully supported. +# +# This example is provided for educational purposes and as a starting point for +# custom builds. If you need help with custom deployments, please create a +# discussion at: https://github.com/hookdeck/outpost/discussions + +# Stage 0 +# Build the binaries +FROM golang:1.23-alpine +WORKDIR /app +COPY go.mod go.sum ./ +RUN go mod download +COPY . . + +# Build all binaries +RUN go build -o ./bin/outpost ./cmd/outpost/main.go && \ + go build -o ./bin/outpost-server ./cmd/outpost-server/main.go && \ + go build -o ./bin/outpost-migrate-redis ./cmd/outpost-migrate-redis/main.go + +# Stage 1 +# Get busybox shell for entrypoint script +FROM busybox:1.36-musl AS busybox + +# Stage 2 +# Copy binaries to a new image +FROM gcr.io/distroless/base-debian12:nonroot + +# Copy statically linked shell from busybox for entrypoint script +COPY --from=busybox /bin/sh /bin/sh + +# Copy all binaries +COPY --from=0 /app/bin/outpost /usr/local/bin/outpost +COPY --from=0 /app/bin/outpost-server /usr/local/bin/outpost-server +COPY --from=0 /app/bin/outpost-migrate-redis /usr/local/bin/outpost-migrate-redis + +# Copy entrypoint script +COPY --from=0 /app/build/entrypoint.sh /usr/local/bin/entrypoint.sh + +# Default entrypoint runs migrations and starts server +ENTRYPOINT ["/bin/sh", "/usr/local/bin/entrypoint.sh"]