Lightsail: Difference between revisions
(Created page with "== Build and Deploy to Lightsail == Create dockerfile <pre> FROM python:3.11-slim as build EXPOSE 5003/tcp WORKDIR /app COPY requirements.txt . RUN pip install -r require...") |
|||
| Line 35: | Line 35: | ||
<pre>docker run -it --rm -p 8080:8080 test-container</pre> | <pre>docker run -it --rm -p 8080:8080 test-container</pre> | ||
Push the Container | Push the Container | ||
Note, this requires some configuration. Please see [https://lightsail.aws.amazon.com/ls/docs/en_us/articles/lightsail-how-to-set-up-access-keys-to-use-sdk-api-cli this guide] for instructions. | |||
<pre>aws lightsail push-container-image \ | <pre>aws lightsail push-container-image \ | ||
--region us-east-2 \ | --region us-east-2 \ | ||
Latest revision as of 05:45, 19 December 2023
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