소스 검색

Merge pull request #218 from meienberger/production-build

refactore: change production to use ubuntu instead of alpine image
Nicolas Meienberger 2 년 전
부모
커밋
e11569a4ab
4개의 변경된 파일58개의 추가작업 그리고 10개의 파일을 삭제
  1. 15 5
      Dockerfile
  2. 0 2
      docker-compose.rc.yml
  3. 1 3
      docker-compose.yml
  4. 42 0
      scripts/configure.sh

+ 15 - 5
Dockerfile

@@ -19,12 +19,25 @@ COPY ./packages/dashboard /dashboard
 RUN npm run build
 RUN npm run build
 
 
 
 
-FROM alpine:3.16.0 as app
+FROM ubuntu:22.04 as app
 
 
 WORKDIR /
 WORKDIR /
 
 
+RUN apt-get update 
+# Install docker
+RUN apt-get install -y ca-certificates curl gnupg lsb-release jq
+RUN mkdir -p /etc/apt/keyrings
+RUN curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
+RUN echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list >/dev/null
+RUN apt-get update
+RUN apt-get install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin
+
+# Install node
+RUN curl -fsSL https://deb.nodesource.com/setup_16.x | bash -
+RUN apt-get install -y nodejs
+
 # Install dependencies
 # Install dependencies
-RUN apk --no-cache add docker-compose nodejs npm bash g++ make git
+RUN apt-get install -y bash g++ make git 
 
 
 RUN npm install node-gyp -g
 RUN npm install node-gyp -g
 
 
@@ -37,9 +50,6 @@ COPY ./packages/dashboard/package*.json /dashboard/
 RUN npm install --production
 RUN npm install --production
 
 
 COPY --from=build /api/dist /api/dist
 COPY --from=build /api/dist /api/dist
-COPY ./packages/system-api /api
-
 COPY --from=build /dashboard/.next /dashboard/.next
 COPY --from=build /dashboard/.next /dashboard/.next
-COPY ./packages/dashboard /dashboard
 
 
 WORKDIR /
 WORKDIR /

+ 0 - 2
docker-compose.rc.yml

@@ -62,8 +62,6 @@ services:
       APPS_REPO_ID: ${APPS_REPO_ID}
       APPS_REPO_ID: ${APPS_REPO_ID}
       APPS_REPO_URL: ${APPS_REPO_URL}
       APPS_REPO_URL: ${APPS_REPO_URL}
       DOMAIN: ${DOMAIN}
       DOMAIN: ${DOMAIN}
-    dns:
-      - ${DNS_IP}
     networks:
     networks:
       - tipi_main_network
       - tipi_main_network
     labels:
     labels:

+ 1 - 3
docker-compose.yml

@@ -1,4 +1,4 @@
-version: "3.9"
+version: "3.7"
 
 
 services:
 services:
   reverse-proxy:
   reverse-proxy:
@@ -62,8 +62,6 @@ services:
       APPS_REPO_ID: ${APPS_REPO_ID}
       APPS_REPO_ID: ${APPS_REPO_ID}
       APPS_REPO_URL: ${APPS_REPO_URL}
       APPS_REPO_URL: ${APPS_REPO_URL}
       DOMAIN: ${DOMAIN}
       DOMAIN: ${DOMAIN}
-    dns:
-      - ${DNS_IP}
     networks:
     networks:
       - tipi_main_network
       - tipi_main_network
     labels:
     labels:

+ 42 - 0
scripts/configure.sh

@@ -108,6 +108,28 @@ function install_jq() {
   fi
   fi
 }
 }
 
 
+function install_openssl() {
+  local os="${1}"
+  echo "Installing openssl for os ${os}" >/dev/tty
+
+  if [[ "${os}" == "debian" || "${os}" == "ubuntu" || "${os}" == "pop" ]]; then
+    sudo apt-get update
+    sudo apt-get install -y openssl
+    return 0
+  elif [[ "${os}" == "centos" ]]; then
+    sudo yum install -y openssl
+    return 0
+  elif [[ "${os}" == "fedora" ]]; then
+    sudo dnf -y install openssl
+    return 0
+  elif [[ "${os}" == "arch" ]]; then
+    sudo pacman -Sy --noconfirm openssl
+    return 0
+  else
+    return 1
+  fi
+}
+
 OS="$(cat /etc/[A-Za-z]*[_-][rv]e[lr]* | grep "^ID=" | cut -d= -f2 | uniq | tr '[:upper:]' '[:lower:]' | tr -d '"')"
 OS="$(cat /etc/[A-Za-z]*[_-][rv]e[lr]* | grep "^ID=" | cut -d= -f2 | uniq | tr '[:upper:]' '[:lower:]' | tr -d '"')"
 SUB_OS="$(cat /etc/[A-Za-z]*[_-][rv]e[lr]* | grep "^ID_LIKE=" | cut -d= -f2 | uniq | tr '[:upper:]' '[:lower:]' | tr -d '"')"
 SUB_OS="$(cat /etc/[A-Za-z]*[_-][rv]e[lr]* | grep "^ID_LIKE=" | cut -d= -f2 | uniq | tr '[:upper:]' '[:lower:]' | tr -d '"')"
 
 
@@ -170,3 +192,23 @@ if ! command -v jq >/dev/null; then
     fi
     fi
   fi
   fi
 fi
 fi
+
+if ! command -v openssl >/dev/null; then
+  install_openssl "${OS}"
+  openssl_result=$?
+
+  if [[ openssl_result -eq 0 ]]; then
+    echo "openssl installed"
+  else
+    echo "Your system ${OS} is not supported trying with sub_os ${SUB_OS}"
+    install_openssl "${SUB_OS}"
+    openssl_sub_result=$?
+
+    if [[ openssl_sub_result -eq 0 ]]; then
+      echo "openssl installed"
+    else
+      echo "Your system ${SUB_OS} is not supported please install openssl manually"
+      exit 1
+    fi
+  fi
+fi