vapor.dockerfile 632 B

123456789101112131415161718192021222324252627
  1. # ================================
  2. # Build image
  3. # ================================
  4. FROM vapor/swift:5.1 as build
  5. WORKDIR /build
  6. # Copy entire repo into container
  7. COPY ./app .
  8. # Compile with optimizations
  9. RUN swift build \
  10. --enable-test-discovery \
  11. -c release
  12. # ================================
  13. # Run image
  14. # ================================
  15. FROM vapor/ubuntu:18.04
  16. WORKDIR /run
  17. # Copy build artifacts
  18. COPY --from=build /build/.build/release /run
  19. # Copy Swift runtime libraries
  20. COPY --from=build /usr/lib/swift/ /usr/lib/swift/
  21. ENTRYPOINT ["./app", "serve", "--env", "production", "--hostname", "0.0.0.0", "--port", "8080"]