Build and Deploy to Lightsail

Create dockerfile

FROM python:3.11-slim as build

EXPOSE 5003/tcp

WORKDIR /app

COPY requirements.txt .

RUN pip install -r requirements.txt

copy . .

CMD [ "python", "./app.py" ]

Create .dockerignore

.idea/
.git/
venv/
Website/venv/
__pycache__/

Build

docker build -t test-container .


Test

docker run -it --rm -p 8080:8080 test-container

Push the Container

Note, this requires some configuration. Please see this guide for instructions.

aws lightsail push-container-image    \
    --region us-east-2               \
    --service-name default \
    --label test-container \
    --image test-container