serverless.dockerfile 697 B

1234567891011121314151617181920212223242526272829303132333435
  1. FROM golang:1.22-alpine as builder
  2. ARG VERSION=unknown
  3. # copy project
  4. COPY . /app
  5. # set working directory
  6. WORKDIR /app
  7. # using goproxy if you have network issues
  8. # ENV GOPROXY=https://goproxy.cn,direct
  9. # build
  10. RUN CGO_ENABLED=0 go build \
  11. -ldflags "\
  12. -X 'github.com/langgenius/dify-plugin-daemon/internal/manifest.VersionX=${VERSION}' \
  13. -X 'github.com/langgenius/dify-plugin-daemon/internal/manifest.BuildTimeX=$(date -u +%Y-%m-%dT%H:%M:%S%z)'" \
  14. -o /app/main cmd/server/main.go
  15. FROM alpine:latest
  16. COPY --from=builder /app/main /app/main
  17. WORKDIR /app
  18. # check build args
  19. ARG PLATFORM=serverless
  20. ENV PLATFORM=$PLATFORM
  21. ENV GIN_MODE=release
  22. # run the server
  23. CMD ["./main"]