amb-relay/Dockerfile.relay

34 lines
586 B
Text

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