From e12dac7d6d436ac527b59a443eb1e353e492fb6b Mon Sep 17 00:00:00 2001 From: Vassiliy Yegorov Date: Wed, 14 Dec 2022 14:57:09 +0700 Subject: [PATCH] fix --- Dockerfile | 34 +++++++++++++++++++-- assets/build/install.sh | 47 ----------------------------- assets/usr/local/sbin/storage/s3.sh | 7 +++-- 3 files changed, 36 insertions(+), 52 deletions(-) delete mode 100644 assets/build/install.sh diff --git a/Dockerfile b/Dockerfile index 673629a..cd3e8bd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,8 +6,38 @@ LABEL maintainer="${DOCKER_MAINTAINER}" COPY assets/build /build WORKDIR /build -RUN chmod +x *.sh && \ - ./install.sh +RUN set -e && DEBIAN_FRONTEND=noninteractive && \ + apt-get update && \ + apt-get install -y gnupg2 wget iputils-ping curl nano ca-certificates apt-transport-https lsb-release && \ + echo deb http://archive.ubuntu.com/ubuntu $(lsb_release -cs) main restricted universe multiverse > /etc/apt/sources.list && \ + echo deb http://archive.ubuntu.com/ubuntu $(lsb_release -cs)-updates main restricted universe multiverse >> /etc/apt/sources.list && \ + echo deb http://archive.ubuntu.com/ubuntu $(lsb_release -cs)-security main restricted universe multiverse >> /etc/apt/sources.list + +RUN echo -e "\n====> Install PGSQL + Mysql" && \ + wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor | tee /usr/share/keyrings/postgresql.gpg > /dev/null && \ + echo deb [arch=amd64 signed-by=/usr/share/keyrings/postgresql.gpg] http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main | tee -a /etc/apt/sources.list.d/postgresql.list && \ + apt-get update && \ + apt-cache search postgresql-client-* && \ + apt-get install -y postgresql-client-10 postgresql-client-12 postgresql-client-14 mysql-client + +RUN echo -e "\n====> Install Mongo" && \ + MONGO_VER=4.4 && \ + wget -qO - https://www.mongodb.org/static/pgp/server-${MONGO_VER}.asc | gpg --dearmor | tee /usr/share/keyrings/mongodb.gpg > /dev/null && \ + echo deb [arch=amd64 signed-by=/usr/share/keyrings/mongodb.gpg] https://repo.mongodb.org/apt/ubuntu $(lsb_release -cs)/mongodb-org/${MONGO_VER} multiverse | tee -a /etc/apt/sources.list.d/mongodb-org-${MONGO_VER}.list && \ + apt-get update && \ + apt-get install mongodb-org-tools -y + +RUN echo -e "\n====> Install Mo" && \ + curl -sSL https://git.io/get-mo -o mo && \ + chmod +x mo && \ + mv mo /usr/local/bin/ + +RUN echo -e "\n====> Install S3" && \ + apt-get install rclone + +RUN echo -e "\n====> Post install tasks" && \ + mkdir -p /srv/backup && \ + apt-get clean COPY assets/ / WORKDIR /usr/local/sbin diff --git a/assets/build/install.sh b/assets/build/install.sh deleted file mode 100644 index ff32ca3..0000000 --- a/assets/build/install.sh +++ /dev/null @@ -1,47 +0,0 @@ -#!/usr/bin/env bash - -set -e - -DEBIAN_FRONTEND=noninteractive - -apt-get update && \ -apt-get install -y gnupg2 wget iputils-ping curl nano ca-certificates apt-transport-https lsb-release && \ - -echo deb http://archive.ubuntu.com/ubuntu $(lsb_release -cs) main restricted universe multiverse > /etc/apt/sources.list && \ -echo deb http://archive.ubuntu.com/ubuntu $(lsb_release -cs)-updates main restricted universe multiverse >> /etc/apt/sources.list && \ -echo deb http://archive.ubuntu.com/ubuntu $(lsb_release -cs)-security main restricted universe multiverse >> /etc/apt/sources.list && \ - -# psql -echo -e "\n====> Install PGSQL + Mysql" -wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor | tee /usr/share/keyrings/postgresql.gpg > /dev/null && \ -echo deb [arch=amd64 signed-by=/usr/share/keyrings/postgresql.gpg] http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main | tee -a /etc/apt/sources.list.d/postgresql.list && \ -apt-get update && \ -apt-cache search postgresql-client-* && \ -apt-get install -y postgresql-client-10 postgresql-client-12 postgresql-client-14 mysql-client - - -# mongo -echo -e "\n====> Install Mongo" -MONGO_VER=4.4 - -wget -qO - https://www.mongodb.org/static/pgp/server-${MONGO_VER}.asc | gpg --dearmor | tee /usr/share/keyrings/mongodb.gpg > /dev/null && \ -echo deb [arch=amd64 signed-by=/usr/share/keyrings/mongodb.gpg] https://repo.mongodb.org/apt/ubuntu $(lsb_release -cs)/mongodb-org/${MONGO_VER} multiverse | tee -a /etc/apt/sources.list.d/mongodb-org-${MONGO_VER}.list && \ -apt-get update -apt-get install mongodb-org-tools -y - -# mo -echo -e "\n====> Install Mo" -curl -sSL https://git.io/get-mo -o mo -chmod +x mo -mv mo /usr/local/bin/ - -# s3 -echo -e "\n====> Install S3" -apt-get install rclone - - -# Post install tasks -echo -e "\n====> Post install tasks" -mkdir -p /srv/backup -find /etc/cron.* -type f ! -name .placeholder -delete -apt-get clean diff --git a/assets/usr/local/sbin/storage/s3.sh b/assets/usr/local/sbin/storage/s3.sh index 3f27a26..8cd923d 100644 --- a/assets/usr/local/sbin/storage/s3.sh +++ b/assets/usr/local/sbin/storage/s3.sh @@ -21,9 +21,9 @@ if [[ -n "${DEBUG}" ]]; then fi storage_login() { - config=/root/.config/rclone/rclone.config + local config=/root/.config/rclone/rclone.conf - [ -f $config ] && rm $config + [ -f ${config} ] && rm ${config} echo S3_BUCKET=${S3_BUCKET} > .env echo S3_REGION=${S3_REGION} >> .env @@ -31,7 +31,8 @@ storage_login() { echo S3_ACCOUNT_ID=${ACCOUNT_ID} >> .env echo S3_APPLICATION_KEY=${APPLICATION_KEY} >> .env - mo -s=.env -u /usr/local/sbin/storage/s3.template > $config + mkdir -p /root/.config/rclone + mo -s=.env -u /usr/local/sbin/storage/s3.template > ${config} log "Setup to S3 by ${S3_ACCOUNT_ID} to ${S3_HOST_BASE}" && \ export S3_CONNECTION=true