-
Notifications
You must be signed in to change notification settings - Fork 8
/
Dockerfile
38 lines (30 loc) · 1006 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
37
38
FROM alpine:3.14
RUN apk add --no-cache curl jq
WORKDIR /app
ARG GITHUB_ORG
ARG GITHUB_REPO
ENV GITHUB_ORG $GITHUB_ORG
ENV GITHUB_REPO $GITHUB_REPO
RUN arch=$(uname -m) && \
os=$(uname -s) && \
case "$arch" in \
x86_64) arch="amd64" ;; \
aarch64) arch="arm64" ;; \
*) echo "Unsupported architecture: $arch" && exit 1 ;; \
esac && \
case "$os" in \
Linux) os="linux" ;; \
Darwin) os="darwin" ;; \
*) echo "Unsupported OS: $os" && exit 1 ;; \
esac && \
RELEASE_URL=$(curl -sfL https://api.github.com/repos/${GITHUB_ORG}/${GITHUB_REPO}/releases/latest | \
jq -r --arg binary "${GITHUB_REPO}-${os}-${arch}" '.assets[] | select(.name == $binary) | .browser_download_url') && \
echo "Downloading binary" && \
curl -sfL ${RELEASE_URL} -o ${GITHUB_REPO} && \
chmod +x ${GITHUB_REPO}
RUN cat > /entrypoint.sh <<'EOF'
#!/bin/sh
exec /app/${GITHUB_REPO} "$@"
EOF
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]