Fork github.com/mattn/go-sqlite3 with adjustment for go1.16.2
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
1.4 KiB

  1. # =============================================================================
  2. # Multi-stage Dockerfile Example
  3. # =============================================================================
  4. # This is a simple Dockerfile that will build an image of scratch-base image.
  5. # Usage:
  6. # docker build -t simple:local . && docker run --rm simple:local
  7. # =============================================================================
  8. # -----------------------------------------------------------------------------
  9. # Build Stage
  10. # -----------------------------------------------------------------------------
  11. FROM golang:alpine AS build
  12. # Important:
  13. # Because this is a CGO enabled package, you are required to set it as 1.
  14. ENV CGO_ENABLED=1
  15. RUN apk add --no-cache \
  16. # Important: required for go-sqlite3
  17. gcc \
  18. # Required for Alpine
  19. musl-dev
  20. WORKDIR /workspace
  21. COPY . /workspace/
  22. RUN \
  23. go mod init github.com/mattn/sample && \
  24. go mod tidy && \
  25. go install -ldflags='-s -w -extldflags "-static"' ./simple.go
  26. RUN \
  27. # Smoke test
  28. set -o pipefail; \
  29. /go/bin/simple | grep 99\ こんにちは世界099
  30. # -----------------------------------------------------------------------------
  31. # Main Stage
  32. # -----------------------------------------------------------------------------
  33. FROM scratch
  34. COPY --from=build /go/bin/simple /usr/local/bin/simple
  35. ENTRYPOINT [ "/usr/local/bin/simple" ]