# Build stage
FROM golang:1.25-bookworm AS build

WORKDIR /src
COPY main.go . 

# Build a static-ish binary
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o passgen main.go

# Runtime stage: minimal image with just the binary + wordlist
FROM debian:13-slim

WORKDIR /app

# Copy binary and wordlist
COPY --from=build /src/passgen /app/passgen
COPY words.txt /app/words.txt

ENV WORDLIST=/app/words.txt
ENV PORT=8000

EXPOSE 8000

CMD ["/app/passgen"]