GraphQL API and utilities for the rpdata project
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.

36 lines
1.4 KiB

  1. ## 1. Build Server
  2. # Use Go 1.10
  3. FROM golang:1.11 AS build-server
  4. # Load repository into docker
  5. WORKDIR /go/src/git.aiterp.net/rpdata/api/
  6. COPY . .
  7. RUN rm -rf ./vendor
  8. # Install build tools and dependencies
  9. RUN go get -u github.com/golang/dep/cmd/dep
  10. RUN go get -u github.com/vektah/gorunpkg
  11. RUN dep ensure
  12. RUN go generate ./...
  13. # Build server and tools (CGO disabled to make them 100% static)
  14. ENV CGO_ENABLED 0
  15. RUN go build -installsuffix cgo -ldflags="-s -w" -o /binaries/rpdata-server ./cmd/rpdata-server
  16. RUN go build -installsuffix cgo -ldflags="-s -w" -o /binaries/rpdata-lb2charimport ./cmd/rpdata-lb2charimport
  17. RUN go build -installsuffix cgo -ldflags="-s -w" -o /binaries/rpdata-lb2logimport ./cmd/rpdata-lb2logimport
  18. # TODO: RUN go build -installsuffix cgo -ldflags="-s -w" -o /binaries/rpdata-wikifileimport ./cmd/rpdata-wikifileimport
  19. RUN go build -installsuffix cgo -ldflags="-s -w" -o /binaries/rpdata-ensurechannels ./cmd/rpdata-ensurechannels
  20. RUN go build -installsuffix cgo -ldflags="-s -w" -o /binaries/rpdata-as2storyimport ./cmd/rpdata-as2storyimport
  21. ## 2. Distribute
  22. # Use alpine linux
  23. FROM alpine:3.7
  24. # Install certificates to enable HTTPS GET requests, and tzdata for log imports.
  25. RUN apk add --no-cache ca-certificates tzdata
  26. # Copy build files into final container
  27. COPY --from=build-server /binaries/* /usr/local/bin/
  28. # The server is the main entry point
  29. CMD ["/usr/local/bin/rpdata-server"]