Dockerfile 460 B

1234567891011121314151617181920212223
  1. # Build image
  2. FROM golang:1.21 AS build
  3. WORKDIR /build
  4. # Configure known hosts
  5. RUN mkdir -p /root/.ssh && ssh-keyscan github.com >> /root/.ssh/known_hosts
  6. # Copy source
  7. COPY go.mod go.sum main.go ./
  8. COPY internal ./internal
  9. # Install dependencies and build
  10. RUN go install
  11. RUN go build -o shorty
  12. # Distribution image
  13. FROM debian:12
  14. # Copy binary and set as command
  15. COPY --from=build /build/shorty /usr/local/bin/shorty
  16. ENTRYPOINT ["shorty"]
  17. CMD ["start"]