Jeremy Zheng 9 месяцев назад
Родитель
Сommit
2d4fb33d43

+ 2 - 0
ai-translate/docker/.gitignore

@@ -0,0 +1,2 @@
+*.tar
+*.md5

+ 0 - 0
ai-translate/Dockerfile → ai-translate/docker/Dockerfile


+ 2 - 2
ai-translate/build.sh → ai-translate/docker/build.sh

@@ -9,11 +9,11 @@ fi
 
 export VERSION=$(date "+%4Y%m%d%H%M%S")
 export CODE="mint-python$1"
-export TAR="$CODE-$VERSION"
+export TAR="$CODE-$VERSION-$(uname -m)"
 
 podman pull ubuntu:latest
 podman build --build-arg PYTHON_VERSION=$1 -t $CODE .
-podman save --format=oci-archive -o $TAR-$(uname -m).tar $CODE
+podman save --format=oci-archive -o $TAR.tar $CODE
 md5sum $TAR.tar >$TAR.md5
 
 echo "done($TAR.tar)."

+ 0 - 0
ai-translate/shell.sh → ai-translate/docker/run.sh


+ 2 - 0
api-v12/docker/.gitignore

@@ -0,0 +1,2 @@
+*.tar
+*.md5

+ 31 - 0
api-v12/docker/Dockerfile

@@ -0,0 +1,31 @@
+FROM ubuntu:latest
+LABEL maintainer="Kassapa"
+
+ENV DEBIAN_FRONTEND noninteractive
+# https://launchpad.net/~deadsnakes/+archive/ubuntu/ppa
+ARG _VERSION=3.13
+
+RUN apt update
+RUN apt -y install lsb-release apt-utils \
+    debian-keyring debian-archive-keyring apt-transport-https software-properties-common curl wget gnupg
+RUN add-apt-repository -y ppa:ondrej/php
+RUN apt -y upgrade
+RUN apt -y install git vim locales locales-all tzdata build-essential \
+    php${PHP_VERSION}-cli php${PHP_VERSION}-fpm \
+    php${PHP_VERSION}-xml php${PHP_VERSION}-imap php${PHP_VERSION}-intl php${PHP_VERSION}-mbstring php${PHP_VERSION}-bcmath \
+    php${PHP_VERSION}-bz2 php${PHP_VERSION}-zip php${PHP_VERSION}-curl php${PHP_VERSION}-gd php${PHP_VERSION}-imagick \
+    php${PHP_VERSION}-pgsql php${PHP_VERSION}-mysql php${PHP_VERSION}-sqlite3 php${PHP_VERSION}-redis php${PHP_VERSION}-amqp
+RUN apt -y autoremove
+RUN apt -y clean
+
+RUN echo "en_US.UTF-8 UTF-8" > /etc/locale.gen
+RUN locale-gen
+RUN update-locale LANG=en_US.UTF-8
+RUN update-alternatives --set editor /usr/bin/vim.basic
+
+RUN echo "$(date -u +%4Y%m%d%H%M%S)" | tee /VERSION
+
+VOLUME /srv
+WORKDIR /srv
+
+CMD ["/bin/bash", "-l"]

+ 21 - 0
api-v12/docker/build.sh

@@ -0,0 +1,21 @@
+#!/bin/bash
+
+set -e
+
+if [ "$#" -ne 1 ]; then
+    echo "USAGE: $0 PYTHON_VERSION"
+    exit 1
+fi
+
+export VERSION=$(date "+%4Y%m%d%H%M%S")
+export CODE="mint-php$1"
+export TAR="$CODE-$VERSION-$(uname -m)"
+
+podman pull ubuntu:latest
+podman build --build-arg PHP_VERSION=$1 -t $CODE .
+podman save --format=oci-archive -o $TAR.tar $CODE
+md5sum $TAR.tar >$TAR.md5
+
+echo "done($TAR.tar)."
+
+exit 0

+ 8 - 0
api-v12/docker/run.sh

@@ -0,0 +1,8 @@
+#!/bin/bash
+
+if [ "$#" -ne 1 ]; then
+    echo "USAGE: $0 PHP_VERSION"
+    exit 1
+fi
+
+podman run --rm -it --events-backend=file --hostname=palm --network host -v $PWD:/srv:z "mint-php$1"

+ 14 - 0
deploy/roles/mint-v2.1/tasks/clove.yml

@@ -3,14 +3,28 @@
     repo: "https://github.com/iapt-platform/clove.git"
     dest: "{{ app_deploy_target | dirname }}/clove"
 
+# - name: Clean resources for v8
+#   ansible.builtin.file:
+#     path: "{{ app_deploy_target }}/api-v8/storage/resources"
+#     state: absent
+
 - name: Setup resources for v8
+  become: true
   ansible.builtin.file:
     src: "{{ app_deploy_target | dirname }}/clove"
     dest: "{{ app_deploy_target }}/api-v8/storage/resources"
     state: link
+    force: true
+
+# - name: Clean resources for v12
+#   ansible.builtin.file:
+#     path: "{{ app_deploy_target }}/api-v12/storage/resources"
+#     state: absent
 
 - name: Setup resources for v12
+  become: true
   ansible.builtin.file:
     src: "{{ app_deploy_target | dirname }}/clove"
     dest: "{{ app_deploy_target }}/api-v12/storage/resources"
     state: link
+    force: true

+ 1 - 0
docker/mint/Dockerfile

@@ -2,6 +2,7 @@ FROM ubuntu:latest
 LABEL maintainer="Jeremy Zheng"
 
 ENV DEBIAN_FRONTEND noninteractive
+# https://launchpad.net/~ondrej/+archive/ubuntu/php
 ARG PHP_VERSION=8.4
 
 RUN apt update