Customized Dockerfile

Here is my customized Dockerfile

Before use it, git clone your project first, here is the example from the official doc, use your own app:

# Clone your Anvil app onto your machine
$ git clone ssh://bridget%40anvil.works@anvil.works:2222/RJYQKQBMRN2JJF6U.git MyApp

Also, replace [you_domain] in the code to your own domain. More info is here: The open source Anvil - Let's Encrypt and cloudflare

FROM python:3

RUN apt-get -yyy update && apt-get -yyy install software-properties-common && \
    wget -O- https://apt.corretto.aws/corretto.key | apt-key add - && \
    add-apt-repository 'deb https://apt.corretto.aws stable main'

RUN wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb && \
    (dpkg -i google-chrome-stable_current_amd64.deb || apt install -y --fix-broken) && \
    rm google-chrome-stable_current_amd64.deb 


RUN apt-get -yyy update && apt-get -yyy install java-1.8.0-amazon-corretto-jdk ghostscript

RUN pip install anvil-app-server
RUN anvil-app-server || true

VOLUME /apps
WORKDIR /apps

COPY MyApp /apps/CustomAppName
RUN mkdir /anvil-data

RUN useradd anvil
RUN chown -R anvil:anvil /anvil-data
USER anvil

EXPOSE 443

ENTRYPOINT ["anvil-app-server", "--data-dir", "/anvil-data", "--port", "443", "--origin", "https://[you_domain]", "--letsencrypt-staging"]
CMD ["--app", "CustomAppName"]
docker build -t mystaticwebsite .
docker run -p 443:443 --name mystaticwebsite mystaticwebsite:latest

Good luck

2 Likes