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.

Dockerfile 1.0KB

1234567891011121314151617181920212223242526272829303132
  1. # This Dockerfile builds everything at once.
  2. # It can be used for an automated build on the Docker Hub.
  3. # Build the backend
  4. FROM golang:latest AS backend-build-env
  5. RUN go get -u github.com/golang/dep/cmd/dep
  6. RUN mkdir -p /go/src/github.com/zottelchin/Votierungstracker
  7. WORKDIR /go/src/github.com/zottelchin/Votierungstracker
  8. COPY *.go /go/src/github.com/zottelchin/Votierungstracker/
  9. COPY Gopkg.* /go/src/github.com/zottelchin/Votierungstracker/
  10. RUN dep ensure
  11. RUN CGO_ENABLED=1 GOOS=linux go build -a -ldflags '-extldflags "-static" -s' -installsuffix cgo -o Votierungstracker -v .
  12. # Build the frontend
  13. FROM node AS frontend-build-env
  14. RUN mkdir -p /frontend
  15. WORKDIR /frontend
  16. COPY frontend/ /frontend/
  17. RUN npm install && npm run build
  18. # Put everything together
  19. FROM scratch
  20. COPY --from=backend-build-env /go/src/github.com/zottelchin/Votierungstracker/Votierungstracker /
  21. COPY --from=frontend-build-env /frontend/dist/ /frontend/dist/
  22. ENV GIN_MODE=release
  23. WORKDIR /
  24. VOLUME /db
  25. EXPOSE 8900
  26. ENTRYPOINT [ "/Votierungstracker" ]