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.

50 lines
1.6 KiB

  1. ## 1. Server
  2. # Use Go 1.10
  3. FROM golang:1.10 AS build-server
  4. # Load repository into docker
  5. WORKDIR /go/src/git.aiterp.net/rpdata/api/
  6. COPY . .
  7. # Load build tools and dependencies
  8. RUN go get -u github.com/golang/dep/cmd/dep
  9. RUN go get -u github.com/jteeuwen/go-bindata/...
  10. RUN dep ensure
  11. RUN go generate ./...
  12. # Build server and tools (CGO disabled to make them 100% static)
  13. ENV CGO_ENABLED 0
  14. RUN go build -a -installsuffix cgo -ldflags="-s -w" -o /binaries/rpdata-graphiql ./cmd/rpdata-graphiql
  15. RUN go build -a -installsuffix cgo -ldflags="-s -w" -o /binaries/rpdata-lb2charimport ./cmd/rpdata-lb2charimport
  16. RUN go build -a -installsuffix cgo -ldflags="-s -w" -o /binaries/rpdata-lb2logimport ./cmd/rpdata-lb2logimport
  17. RUN go build -a -installsuffix cgo -ldflags="-s -w" -o /binaries/rpdata-wikifileimport ./cmd/rpdata-wikifileimport
  18. RUN go build -a -installsuffix cgo -ldflags="-s -w" -o /binaries/rpdata-ensurechannels ./cmd/rpdata-ensurechannels
  19. RUN go build -a -installsuffix cgo -ldflags="-s -w" -o /binaries/rpdata-as2storyimport ./cmd/rpdata-as2storyimport
  20. ## 2. React UI
  21. # Use Node.JS 18
  22. FROM node:10.5-alpine AS build-id
  23. # The content is already there
  24. WORKDIR /rpdata-ui
  25. COPY ./rpdata-ui /rpdata-ui
  26. # Prepare dependencies
  27. RUN npm install
  28. # Run build
  29. RUN npm run build
  30. ## 3. Regroup
  31. # Use alpine linux
  32. FROM alpine:3.7
  33. # Install certificates to enable HTTPS GET requests
  34. RUN apk add --no-cache ca-certificates
  35. # Copy build files into final container
  36. COPY --from=build-server /binaries/* /usr/local/bin/
  37. COPY --from=build-id /rpdata-ui/build /var/www/
  38. # TODO: Use proper server instead of grapihql server
  39. CMD ["/usr/local/bin/rpdata-graphiql"]