Skip to content

Instantly share code, notes, and snippets.

@Miouyouyou
Last active September 24, 2020 23:37
Show Gist options
  • Select an option

  • Save Miouyouyou/1bd70d3d22a1fdba3c0aeacdc4495c54 to your computer and use it in GitHub Desktop.

Select an option

Save Miouyouyou/1bd70d3d22a1fdba3c0aeacdc4495c54 to your computer and use it in GitHub Desktop.
Anvil app server with Docker

Build the Dockerfile

sudo docker build . --tag myy-anvil

Prepare the folders

sudo docker run --rm -v /host/path/where/to/store/your/apps:/usr/src --entrypoint "mkdir" myy-anvil .anvil-data

Create a project

sudo docker run -v /host/path/where/to/store/your/apps:/usr/src --rm --entrypoint "create-anvil-app" myy-anvil todo-list WonderfulName

Launch

sudo docker run -p 3030:3030 -v /host/path/where/to/store/your/apps:/usr/src myy-anvil anvil-app-server --app WonderfulName

TODO

  • Mount /home/applauncher/.anvil as a volume, in order to avoid redownloading the whole app server everytime. Or integrate it within the Docker image maybe ?
  • Create a script to prepare the environment automatically and then run the provided commands
  • Use this script as the actual ENTRYPOINT
FROM python:3
RUN useradd --create-home --shell /bin/bash applauncher
WORKDIR /usr/src
RUN pip install anvil-app-server
RUN apt update
RUN apt -y install openjdk-11-jdk
USER applauncher
# You'd think that the software WOULD DO IT FOR YOU !!
RUN mkdir ~/.anvil
CMD [ "anvil-app-server", "--app" ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment