From 0803aa6e90466b4db2dbb13c130f48bee9c40f69 Mon Sep 17 00:00:00 2001 From: "@s.roertgen" Date: Fri, 25 Apr 2025 15:21:52 +0200 Subject: [PATCH] ...and we need this as well for docker deployment --- .dockerignore | 1 + Dockerfile.relay | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile.relay diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..ff86dbb --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +go.work* diff --git a/Dockerfile.relay b/Dockerfile.relay new file mode 100644 index 0000000..9bb96d0 --- /dev/null +++ b/Dockerfile.relay @@ -0,0 +1,34 @@ +FROM golang:1.24.1-alpine AS builder + +WORKDIR /app + +# Copy go mod and sum files +COPY go.mod go.sum ./ + +# Download all dependencies +RUN go mod download + +# Copy the source code +COPY . . + +# Build the application +RUN CGO_ENABLED=0 GOOS=linux go build -o amb-relay . + +# Start a new stage from scratch +FROM alpine:latest + +WORKDIR /root/ + +# Install netcat for health checking +RUN apk add --no-cache netcat-openbsd + +# Copy the binary from the builder stage +COPY --from=builder /app/amb-relay . + +COPY .env ./ + +# Expose port 3334 +EXPOSE 3334 + +# Command to run the executable +CMD ["./amb-relay"]