Opt: update install script and dockerfile

pull/40/head
zijiren233 1 year ago
parent 2dd309c6ce
commit 71d1b96e69

@ -6,28 +6,26 @@ WORKDIR /synctv
COPY ./ ./
RUN apk add --no-cache bash curl gcc git go musl-dev
RUN bash script/build.sh -P -v ${VERSION}
RUN apk add --no-cache bash curl gcc git go musl-dev && \
bash script/build.sh -P -v ${VERSION}
From alpine:latest
ENV PUID=0 PGID=0 UMASK=022
COPY --from=builder /synctv/build/synctv /usr/local/bin/synctv
COPY script/entrypoint.sh /entrypoint.sh
RUN apk add --no-cache bash ca-certificates su-exec tzdata
RUN chmod +x /entrypoint.sh
ENV PUID=0 PGID=0 UMASK=022
RUN mkdir -p ~/.synctv
RUN apk add --no-cache bash ca-certificates su-exec tzdata && \
rm -rf /var/cache/apk/* && \
chmod +x /entrypoint.sh && \
mkdir -p ~/.synctv
WORKDIR ~/.synctv
EXPOSE 8080/tcp 8080/udp
VOLUME [ ~/.synctv ]
VOLUME [ "~/.synctv" ]
CMD [ "/entrypoint.sh" ]

@ -12,6 +12,11 @@ function Help() {
}
function Init() {
# Check if the user is root or sudo
if [ "$EUID" -ne 0 ]; then
echo "Please run as root"
exit
fi
VERSION="latest"
InitOS
InitArch
@ -112,7 +117,7 @@ function InitDownloadTools() {
function Download() {
case "$download_tool" in
curl)
curl -L "$1" -o "$2"
curl -L "$1" -o "$2" --progress-bar
if [ $? -ne 0 ]; then
echo "download $1 failed"
exit 1
@ -178,6 +183,10 @@ function InstallWithVersion() {
}
function InitLinuxSystemctlService() {
if [ -z "$(command -v systemctl)" ]; then
echo "systemctl command not found"
exit 1
fi
mkdir -p "/opt/synctv"
if [ ! -d "/etc/systemd/system" ]; then
echo "/etc/systemd/system not found"
@ -214,14 +223,6 @@ function InitSystemctlService() {
linux)
InitLinuxSystemctlService
;;
darwin)
echo "darwin not support"
exit 1
;;
*)
echo "OS not supported"
exit 1
;;
esac
}

Loading…
Cancel
Save