-
-
Notifications
You must be signed in to change notification settings - Fork 127
/
dockerfile
36 lines (25 loc) · 883 Bytes
/
dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# syntax=docker/dockerfile:1
FROM debian:12
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
EXPOSE 443 80
VOLUME /config
RUN apt-get update \
&& apt-get install -y ca-certificates openssl fdisk mergerfs snapraid \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Copy the respective binary based on the BINARY_NAME
COPY build/cosmos build/cosmos-arm64 ./
# Copy other resources
COPY build/* ./
COPY static ./static
# Run the respective binary based on the BINARY_NAME
CMD ["sh", "-c", "./$(cat /binary_name)"]