dockerfile 859 B

123456789101112131415161718192021222324252627282930313233343536
  1. # syntax=docker/dockerfile:1
  2. FROM debian:12
  3. ARG TARGETPLATFORM
  4. ARG BINARY_NAME=cosmos
  5. # Set BINARY_NAME based on the TARGETPLATFORM
  6. RUN case "$TARGETPLATFORM" in \
  7. "linux/arm64") BINARY_NAME="cosmos-arm64" ;; \
  8. *) BINARY_NAME="cosmos" ;; \
  9. esac && echo $BINARY_NAME > /binary_name
  10. # This is just to log the platforms (optional)
  11. RUN echo "I am building for $TARGETPLATFORM" > /log
  12. EXPOSE 443 80
  13. VOLUME /config
  14. RUN apt-get update \
  15. && apt-get install -y ca-certificates openssl \
  16. && apt-get clean \
  17. && rm -rf /var/lib/apt/lists/*
  18. WORKDIR /app
  19. # Copy the respective binary based on the BINARY_NAME
  20. COPY build/cosmos build/cosmos-arm64 ./
  21. # Copy other resources
  22. COPY build/* ./
  23. COPY static ./static
  24. # Run the respective binary based on the BINARY_NAME
  25. CMD ["sh", "-c", "./$(cat /binary_name)"]