How do you make a docker image to deploy AI2?

Hi, I am trying to make a docker image that can deploy AI2 anywhere, I have currently tried


FROM openjdk:8

ENV HOME /home/developer

RUN ls

# Install other useful tools
RUN apt-get update && apt-get install -y \
ant \
curl \
git \
sudo \
unzip \
# Install dependency
	lib32z1 \
	lib32stdc++6 \
# Install phantomJS
phantomjs \
# Clean up
 && apt-get clean && apt-get purge \
# Set up some permissions. Replace 1000 with your user/groupid if it is different
 && export uid=1000 gid=1000 \
 && mkdir -p $HOME \
 && echo "developer:x:${uid}:${gid}:Developer,,,:${HOME}:/bin/bash" >> /etc/passwd \
 && echo "developer:x:${uid}:" >> /etc/group \
 && echo "developer ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/developer \
 && chmod 0440 /etc/sudoers.d/developer \
 && chown ${uid}:${gid} -R $HOME \
# Google App engine
 && curl '' > /tmp/ \
 && unzip -d $HOME /tmp/ \
 && rm /tmp/ \
 && ln -s $HOME/appengine-java-sdk-1.9.84 $HOME/appengine

RUN chmod +x $HOME/ \
 && chown ${uid}:${gid} $HOME/


USER developer

set -e

cd /home/developer/appinventor-sources/appinventor

ant RunLocalBuildServer > /dev/null &

/home/developer/appengine/bin/ --port=8888 --address= appengine/build/war/

Any help is appreciated :slight_smile:


There are some things you could leave out. You don't need phantomjs, for example. In reality, what you'd probably want to do is use a gcloud SDK instead since the standalone App Engine SDK is deprecated.

I also don't see where you're adding the compiled binaries to your image, so your script will likely fail.


Maybe this will hep you

PS : @Hrichik_Mazumder Succeeded to do so,

Hi @ewpatton,
I made a GitHub action that builds the appinventor, then builds the docker image and pushes it to the docker registry. The and dockerfile below are for just the frontend and gwt parts except for the build server. To run the build server, the last line of the needs to be replaced by ant RunLocalBuildServer and the EXPOSE 8888 in dockerfile be replaced with EXPOSE 9990 and the dockerfile needs to be built again.


name: Build UI

on: [workflow_dispatch]

name: Push Docker image to Docker Hub after building
runs-on: ubuntu-latest
  - name: Check out the repo
    uses: actions/checkout@v2
  - name: 'Set up JDK 1.8'
    uses: actions/setup-java@v1
      java-version: 8
  - name: 'Checkout submodules'
    uses: textbook/git-checkout-submodule-action@master
  - name: 'Install 32-bit dependencies'
    run: sudo apt-get install -y libc6-i386 lib32z1 lib32stdc++6 ant
  - name: 'Make Auth Key'
    run: ant MakeAuthKey
    working-directory: appinventor
  - name: 'Build Appinventor'
    run: ant noplay        
    working-directory: appinventor

  - name: Log in to Docker Hub
    uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
      username: ${{ secrets.DH_USERNAME }}
      password: ${{ secrets.DH_PASSWORD }}
  - name: Extract metadata (tags, labels) for Docker
    id: meta
    uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
      images: ${{ secrets.DH_USERNAME }}/ai2
  - name: Build and push Docker image
    uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
      context: .
      push: true
      tags: ${{ secrets.DH_USERNAME }}/ai2:${{ github.sha }}
      labels: ${{ secrets.DH_USERNAME }}/ai2:${{ github.sha }}


FROM openjdk:8 
ENV HOME /home/developer 
COPY . . 
RUN echo "deb [signed-by=/usr/share/keyrings/] cloud-sdk main" | tee -a /etc/apt/sources.list.d/google-cloud-sdk.list && curl | apt-key --keyring /usr/share/keyrings/  add - && apt-get update -y && apt-get install google-cloud-sdk -y 
RUN apt-get install -y  ant 
RUN curl '' > /tmp/ \ 
 && unzip -d $HOME /tmp/ \ 
 && rm /tmp/ \ 
 && ln -s $HOME/appengine-java-sdk-1.9.84 $HOME/appengine 

EXPOSE 8888 
RUN ls 
CMD chmod 777 && ./

set -e

cd appinventor

/home/developer/appengine/bin/ --port=8888 --address= appengine/build/war/