#Task
To allow other people to deploy this quickly and easily, I had to dockerize the entire API. That way you can simply pull the image down and deploy it. To do that we needed to first create a `.dockerignore` to make sure we don't copy anything we wouldn't want in our image:
```
*.env
*stupiddockeratm10
*old_templates
*venv
*__pycache__
*kube.yaml
*deployments
*logs
```
- The `stupiddockeratm10` one is a past frustration (LOL)
Then we can build the `Dockerfile` itself to create the image:
```Dockerfile
FROM python:3.11-slim
WORKDIR /app
COPY . .
COPY kubectl /usr/local/bin/kubectl
COPY helm /usr/local/bin/helm
RUN pip install --no-cache-dir -r requirements.txt
EXPOSE 8000
ENTRYPOINT ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000"
```
- Our API is all python, so the obvious choice was `python-slim`
- We set our working directory to `/app`, which is where our app will live inside the container itself
- We copy everything over that isn't ignored by the dockerignore
- `minecraftautomatorapi` that holds our core API functionality
- `routes` that holds all the API routes
- `deps` that holds our python security module
- `app.py` which is the main entrypoint for uvicorn
- `requirements.txt` that holds all the required python packages
- helm and kubectl, which will be used by our application to deploy Kubernetes resources
- We copy the kubectl and helm binaries to our bin, which is in PATH
- Pip install all the required packages
- Expose port 8000 on the container
- Then use the main uvicorn function to start the API
And that's our entire Docker build process!