Переглянути джерело

:fire: merge frontend & backend image

Jeremy Zheng 1 рік тому
батько
коміт
bd844057b1

+ 25 - 0
README.md

@@ -0,0 +1,25 @@
+# International Academy Of Pali Tipitaka(国际巴利三藏学院)
+
+这是一个开放的基于语料库的巴利语学习和翻译平台。
+
+## Usage
+
+## Development
+
+```bash
+$ sudo apt install -y git crun podman buildah fuse-overlayfs
+$ git clone https://github.com/iapt-platform/mint.git ~/workspace/iapt-platform/mint
+$ cd ~/workspace/iapt-platform/mint/
+# Load the mint-spring image
+$ podman load -i tmp/mint-spring-TIMESTAMP.tar.xz
+# Start a backend server
+$ ./docker/spring/start.sh backend 8080 # http://localhost:8080
+# Start a frontend server
+$ ./docker/spring/start.sh frontend 3000 # http://localhost:3000
+```
+
+## Documents
+
+- [Podman Installation Instructions](https://podman.io/docs/installation)
+- [Download Visual Studio Code](https://code.visualstudio.com/download)
+- [Remote Development using SSH](https://code.visualstudio.com/docs/remote/ssh)

+ 2 - 2
deploy/ec2.yml

@@ -7,7 +7,7 @@
     - web
     - task
   roles:
-    # - os
-    # - ubuntu
+    - os
+    - ubuntu
     - container
     - random-passwords

+ 0 - 43
docker/backend/Dockerfile

@@ -1,43 +0,0 @@
-FROM ubuntu:latest
-LABEL maintainer="Jeremy Zheng"
-
-ENV DEBIAN_FRONTEND noninteractive
-
-RUN apt update
-RUN apt -y upgrade
-
-RUN apt -y install zsh git locales locales-all \
-    vim tzdata zip unzip tree tmux \
-    build-essential
-
-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 mkdir -p $HOME/downloads $HOME/build $HOME/local $HOME/tmp
-
-# https://github.com/ohmyzsh/ohmyzsh
-RUN git clone https://github.com/ohmyzsh/ohmyzsh.git $HOME/.oh-my-zsh
-RUN cp $HOME/.oh-my-zsh/templates/zshrc.zsh-template $HOME/.zshrc
-RUN echo 'export LANG=en_US.UTF-8' >> $HOME/.zshrc
-RUN echo 'export LC_ALL=en_US.UTF-8' >> $HOME/.zshrc
-RUN echo 'export PATH=$HOME/.local/bin:$PATH' >> $HOME/.zshrc
-
-RUN git config --global core.quotepath false \
-    && git config --global http.version HTTP/1.1 \
-    && git config --global pull.rebase false \
-    && git config --global url."https://".insteadOf git://
-RUN echo 'set-option -g history-limit 102400' > $HOME/.tmux.conf \
-    && echo 'set-option -g default-shell "/bin/zsh"' >> $HOME/.tmux.conf
-
-
-RUN echo "$(date -u +%4Y%m%d%H%M%S)" | tee /VERSION
-
-VOLUME /workspace
-WORKDIR /workspace
-
-CMD ["/bin/zsh", "-l"]

+ 0 - 15
docker/frontend/build.sh

@@ -1,15 +0,0 @@
-#!/bin/bash
-
-set -e
-
-export VERSION=$(date "+%4Y%m%d%H%M%S")
-export CODE="mint-frontend"
-
-podman pull ubuntu:latest
-podman build -t $CODE .
-podman save --format=oci-archive -o $CODE-$VERSION.tar $CODE
-md5sum $CODE-$VERSION.tar >$CODE-$VERSION.md5
-
-echo "done($CODE-$VERSION.tar)."
-
-exit 0

+ 0 - 10
docker/frontend/start.sh

@@ -1,10 +0,0 @@
-#!/bin/bash
-
-export CODE="mint-frontend"
-export NAME="$CODE-$USER"
-
-if podman container exists $NAME; then
-    podman start -i -a $NAME
-else
-    podman run --name $NAME -it --events-backend=file --hostname=mint --network host -v $PWD:/workspace:z $CODE
-fi

+ 0 - 33
docker/open-search/Dockerfile

@@ -1,33 +0,0 @@
-FROM ubuntu:latest
-LABEL maintainer="Jeremy Zheng"
-
-ENV DEBIAN_FRONTEND noninteractive
-
-RUN apt update
-RUN apt -y upgrade
-RUN apt -y install wget vim locales locales-all tzdata
-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 mkdir -p $HOME/downloads
-
-# https://opensearch.org/downloads.html#opensearch
-ARG OPENSEARCH_ARCH
-ENV OPENSEARCH_VERSION "2.17.0"
-ENV OPENSEARCH_JAVA_HOME "/opt/opensearch-${OPENSEARCH_VERSION}/jdk"
-RUN wget -q -P $HOME/downloads \
-    https://artifacts.opensearch.org/releases/bundle/opensearch/${OPENSEARCH_VERSION}/opensearch-${OPENSEARCH_VERSION}-linux-${OPENSEARCH_ARCH}.tar.gz
-RUN cd /opt && tar xf $HOME/downloads/opensearch-${OPENSEARCH_VERSION}-linux-${OPENSEARCH_ARCH}.tar.gz 
-RUN echo "network.host: 0.0.0.0" >> /opt/opensearch-${OPENSEARCH_VERSION}/config/opensearch.yml
-RUN echo "discovery.type: single-node" >> /opt/opensearch-${OPENSEARCH_VERSION}/config/opensearch.yml 
-RUN echo "plugins.security.disabled: true" >> /opt/opensearch-${OPENSEARCH_VERSION}/config/opensearch.yml
-
-RUN echo "$(date -u +%4Y%m%d%H%M%S)" | tee /VERSION
-
-WORKDIR /opt/opensearch-${OPENSEARCH_VERSION}
-
-CMD ["/opt/opensearch-${OPENSEARCH_VERSION}/bin/opensearch"]

+ 0 - 20
docker/open-search/build.sh

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

+ 0 - 10
docker/open-search/start.sh

@@ -1,10 +0,0 @@
-#!/bin/bash
-
-export CODE="mint-open-search"
-export NAME="$CODE-$USER"
-
-if podman container exists $NAME; then
-    podman start -i -a $NAME
-else
-    podman run --name $NAME -it --events-backend=file --hostname=mint --network host -v $PWD:/workspace:z $CODE
-fi

+ 20 - 2
docker/frontend/Dockerfile → docker/spring/Dockerfile

@@ -6,8 +6,7 @@ ENV DEBIAN_FRONTEND noninteractive
 RUN apt update
 RUN apt -y upgrade
 
-RUN apt -y install zsh git locales locales-all \
-    vim tzdata zip unzip tree tmux \
+RUN apt -y install wget vim locales locales-all tzdata zip unzip tree tmux \
     build-essential
 
 RUN apt -y autoremove
@@ -43,6 +42,25 @@ RUN echo '[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"' >>
 RUN zsh -c "source $HOME/.zshrc \
     && nvm install --lts"
 
+
+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 mkdir -p $HOME/downloads
+
+# https://opensearch.org/downloads.html#opensearch
+ARG OPENSEARCH_ARCH
+ENV OPENSEARCH_VERSION "2.17.0"
+ENV OPENSEARCH_JAVA_HOME "/opt/opensearch-${OPENSEARCH_VERSION}/jdk"
+RUN wget -q -P $HOME/downloads \
+    https://artifacts.opensearch.org/releases/bundle/opensearch/${OPENSEARCH_VERSION}/opensearch-${OPENSEARCH_VERSION}-linux-${OPENSEARCH_ARCH}.tar.gz
+RUN cd /opt && tar xf $HOME/downloads/opensearch-${OPENSEARCH_VERSION}-linux-${OPENSEARCH_ARCH}.tar.gz 
+RUN echo "network.host: 0.0.0.0" >> /opt/opensearch-${OPENSEARCH_VERSION}/config/opensearch.yml
+RUN echo "discovery.type: single-node" >> /opt/opensearch-${OPENSEARCH_VERSION}/config/opensearch.yml 
+RUN echo "plugins.security.disabled: true" >> /opt/opensearch-${OPENSEARCH_VERSION}/config/opensearch.yml
+
+
 RUN echo "$(date -u +%4Y%m%d%H%M%S)" | tee /VERSION
 
 VOLUME /workspace

+ 1 - 1
docker/backend/build.sh → docker/spring/build.sh

@@ -3,7 +3,7 @@
 set -e
 
 export VERSION=$(date "+%4Y%m%d%H%M%S")
-export CODE="mint-backend"
+export CODE="mint-spring"
 
 podman pull ubuntu:latest
 podman build -t $CODE .

+ 1 - 1
docker/backend/start.sh → docker/spring/start.sh

@@ -1,6 +1,6 @@
 #!/bin/bash
 
-export CODE="mint-backend"
+export CODE="mint-spring"
 export NAME="$CODE-$USER"
 
 if podman container exists $NAME; then