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"]