Bladeren bron

:hammer: add tulip docker file

Jeremy Zheng 2 jaren geleden
bovenliggende
commit
3cad3b6350
3 gewijzigde bestanden met toevoegingen van 61 en 0 verwijderingen
  1. 31 0
      rpc/tulip/Dockerfile
  2. 15 0
      rpc/tulip/build.sh
  3. 15 0
      rpc/tulip/start.sh

+ 31 - 0
rpc/tulip/Dockerfile

@@ -0,0 +1,31 @@
+FROM ubuntu:latest
+LABEL maintainer="Jeremy Zheng"
+
+ENV DEBIAN_FRONTEND noninteractive
+
+RUN apt update
+RUN apt install -y apt-utils debian-keyring debian-archive-keyring apt-transport-https software-properties-common gnupg
+RUN LC_ALL=C.UTF-8 add-apt-repository -y ppa:ondrej/php
+RUN apt -y upgrade
+ENV PHP_VERSION="8.2"
+RUN apt install -y sudo wget unzip \
+    php${PHP_VERSION}-zip php${PHP_VERSION}-grpc php${PHP_VERSION}-protobuf
+RUN apt clean
+
+# https://getcomposer.org/download/
+RUN wget https://raw.githubusercontent.com/composer/getcomposer.org/76a7060ccb93902cd7576b67264ad91c8a2700e2/web/installer -O - -q | php -- --quiet --install-dir=/usr/local/bin --filename=composer
+
+RUN useradd -s /bin/bash -m deploy
+RUN passwd -l deploy
+RUN echo 'deploy ALL=(ALL:ALL) NOPASSWD: ALL' > /etc/sudoers.d/101-deploy
+RUN mkdir /opt/tulip
+RUN chown deploy:deploy /opt/tulip
+USER deploy
+
+COPY tulip /opt/tulip/
+RUN cd /opt/tulip && composer install
+RUN echo "$(date -u +%4Y%m%d%H%M%S)" | sudo tee /VERSION
+
+WORKDIR /opt/tulip
+
+CMD ["/bin/bash", "-l"]

+ 15 - 0
rpc/tulip/build.sh

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

+ 15 - 0
rpc/tulip/start.sh

@@ -0,0 +1,15 @@
+#!/bin/bash
+
+set -e
+
+export CODE="mint-tulip"
+
+if [ "$#" -ne 1 ]
+then
+    echo "USAGE: $0 PORT"
+    exit 1
+fi
+
+podman run -d --rm --events-backend=file --hostname=palm --network host $CODE /usr/bin/php server.php --port $1
+
+exit 0