Files
2023-09-07 08:20:38 +00:00

51 lines
1.7 KiB
Markdown

# python-3-8-fastapi
# Base Image
Building the base image requires access to `docker.sciocatti.com` to pull the `docker.sciocatti.com/python:3.8-slim` image. Pulling this base image also requires access. If you do not have access to this registry, you can
1. create your own image by replacing `docker.sciocatti.com/python:3.8-slim` with `python:3.8-slim` in `base_image/Dockerfile.python-3-8-fastapi`, and
1. building the dockerfile and using that as the base.
1. Optionally, you can push that to your own registry.
If you do have access you can update the base image by
1. Updating `base_image/Dockerfile.python-3-8-fastapi`, and
1. Running the following:
```bash
cd base_image
# Build
docker build -f Dockerfile.python-3-8-fastapi -t docker.sciocatti.com/python-3.8-fastapi:{{tag}} .
# Push
docker push docker.sciocatti.com/python-3.8-fastapi:{{tag}}
```
## Installed libraries
- FastApi
- Python-dotenv
- Requests
- MySQL / MariaDB connector
# Changing this from the template
This is almost ready to go as-is, you just need to make some tweaks:
1. Change the port in `deploy/run.sh`. By default the app will be running on port 64000 on your host.
1. Change the name of the output image in `deploy/build.sh` and potentially disable the push to the registry.
1. Change the K3S deployment details in `deploy/deployment.yaml`. This is made specifically for my cluster, so adapt for yours if using yours.
# Running & Building
## Running
You only need docker to run this, and access to relevant images.
```bash
# In project root
bash run.sh
```
## Building
```bash
# In project root
bash build.sh
```
# Deploying
1. Update dockerfile.
1. Build the image.
1. Push the image.
1. Restart deployment in cluster.