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.

37 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. # Load 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 go get -u github.com/jteeuwen/go-bindata/...
  12. RUN dep ensure
  13. RUN go generate ./...
  14. # Build server and tools (CGO disabled to make them 100% static)
  15. ENV CGO_ENABLED 0
  16. RUN go build -a -installsuffix cgo -ldflags="-s -w" -o /binaries/rpdata-server ./cmd/rpdata-server
  17. RUN go build -a -installsuffix cgo -ldflags="-s -w" -o /binaries/rpdata-lb2charimport ./cmd/rpdata-lb2charimport
  18. RUN go build -a -installsuffix cgo -ldflags="-s -w" -o /binaries/rpdata-lb2logimport ./cmd/rpdata-lb2logimport
  19. # TODO: RUN go build -a -installsuffix cgo -ldflags="-s -w" -o /binaries/rpdata-wikifileimport ./cmd/rpdata-wikifileimport
  20. RUN go build -a -installsuffix cgo -ldflags="-s -w" -o /binaries/rpdata-ensurechannels ./cmd/rpdata-ensurechannels
  21. RUN go build -a -installsuffix cgo -ldflags="-s -w" -o /binaries/rpdata-as2storyimport ./cmd/rpdata-as2storyimport
  22. ## 2. Distribute
  23. # Use alpine linux
  24. FROM alpine:3.7
  25. # Install certificates to enable HTTPS GET requests
  26. RUN apk add --no-cache ca-certificates
  27. # Copy build files into final container
  28. COPY --from=build-server /binaries/* /usr/local/bin/
  29. # The server is the main entry point
  30. CMD ["/usr/local/bin/rpdata-server"]