Skip to content

Commit

Permalink
Merge pull request #1 from kw1knode/main
Browse files Browse the repository at this point in the history
add Dockerfile
  • Loading branch information
trader-payne authored Oct 30, 2024
2 parents b807756 + c0c1f38 commit 4000723
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Build stage
FROM golang:1.23-alpine AS builder

WORKDIR /app

# Install build dependencies
RUN apk add --no-cache git

# Copy source code
COPY . .

# Download dependencies
RUN go mod download

# Build the application
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o main .

# Final stage
FROM alpine:latest

WORKDIR /root/

# Install runtime dependencies
RUN apk --no-cache add ca-certificates

# Copy the binary from builder
COPY --from=builder /app/main .

# Expose port (adjust as needed)
EXPOSE 8080

# Run the binary
CMD ["./main"]

0 comments on commit 4000723

Please sign in to comment.