gitea-register-account-bot/Dockerfile

24 lines
461 B
Docker
Raw Permalink Normal View History

2024-01-10 00:10:39 +01:00
# Start from a Go base image
FROM golang:alpine3.19 AS builder
2024-01-10 00:10:39 +01:00
# Set the working directory
WORKDIR /app
# Copy the source code into the container
COPY . .
RUN go mod download
2024-01-10 00:10:39 +01:00
# Build the application
RUN CGO_ENABLED=0 GOOS=linux go build -o mybot .
2024-01-10 00:10:39 +01:00
# Use a small base image
FROM alpine:edge
2024-01-10 00:10:39 +01:00
WORKDIR /app/
2024-01-10 00:10:39 +01:00
# Copy the binary from the builder stage
COPY --from=builder /app/mybot /app/
2024-01-10 00:10:39 +01:00
# Command to run the executable
CMD ["./mybot"]