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.

38 lines
1.5 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. RUN go build -a -installsuffix cgo -ldflags="-s -w" -o /binaries/rpdata-logpaste ./cmd/rpdata-logpaste
  23. ## 2. Distribute
  24. # Use alpine linux
  25. FROM alpine:3.7
  26. # Install certificates to enable HTTPS GET requests
  27. RUN apk add --no-cache ca-certificates
  28. # Copy build files into final container
  29. COPY --from=build-server /binaries/* /usr/local/bin/
  30. # The server is the main entry point
  31. CMD ["/usr/local/bin/rpdata-server"]