Cosmos-Server/dockerfile

36 lines
859 B
Plaintext
Raw Normal View History

2023-03-10 20:59:56 +00:00
# syntax=docker/dockerfile:1
2023-08-11 09:46:22 +00:00
FROM debian:12
2023-03-10 20:59:56 +00:00
2023-08-11 09:18:24 +00:00
ARG TARGETPLATFORM
ARG BINARY_NAME=cosmos
# Set BINARY_NAME based on the TARGETPLATFORM
RUN case "$TARGETPLATFORM" in \
"linux/arm64") BINARY_NAME="cosmos-arm64" ;; \
*) BINARY_NAME="cosmos" ;; \
esac && echo $BINARY_NAME > /binary_name
# This is just to log the platforms (optional)
RUN echo "I am building for $TARGETPLATFORM" > /log
2023-03-25 20:15:00 +00:00
EXPOSE 443 80
VOLUME /config
2023-08-11 10:00:07 +00:00
RUN apt-get update \
&& apt-get install -y ca-certificates openssl \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
2023-05-27 17:11:33 +00:00
2023-05-28 10:44:28 +00:00
WORKDIR /app
2023-05-27 17:25:22 +00:00
2023-08-11 09:18:24 +00:00
# Copy the respective binary based on the BINARY_NAME
2023-08-11 11:58:16 +00:00
COPY build/cosmos build/cosmos-arm64 ./
2023-08-11 09:18:24 +00:00
# Copy other resources
2023-08-20 10:36:52 +00:00
COPY build/* ./
2023-05-28 10:44:28 +00:00
COPY static ./static
2023-03-10 20:59:56 +00:00
2023-08-11 09:18:24 +00:00
# Run the respective binary based on the BINARY_NAME
CMD ["sh", "-c", "./$(cat /binary_name)"]