You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on May 20, 2025. It is now read-only.
RUN pip install --no-cache-dir --upgrade pip pipenv
460
+
461
+
COPY Pipfile Pipfile.lock ./
462
+
463
+
RUN pipenv install --system --categories="packages ml" --skip-lock --deploy --verbose
464
+
465
+
COPY . .
466
+
467
+
ENTRYPOINT python3.11 -u $HANDLER
468
+
```
469
+
470
+
We'll also add an ignorefile for this Dockerfile to try and keep the image size down.
471
+
472
+
```gitignore
473
+
.mypy_cache/
474
+
.nitric/
475
+
.venv/
476
+
.model/
374
477
```
375
478
479
+
Next we'll define a `standard` runtime for our normal services that we want to deploy along with our batch service. under `docker/standard.dockerfile`.
480
+
481
+
```dockerfile
482
+
ARG IMAGE_BASE=python:3.11-slim
483
+
484
+
FROM ${IMAGE_BASE}
485
+
486
+
ARG HANDLER
487
+
488
+
ENV HANDLER=${HANDLER}
489
+
ENV PYTHONUNBUFFERED=TRUE
490
+
ENV PYTHONPATH="."
491
+
492
+
RUN apt-get update -y && \
493
+
apt-get install -y ca-certificates git && \
494
+
update-ca-certificates
495
+
496
+
RUN pip install --no-cache-dir --upgrade pip pipenv
497
+
498
+
COPY . .
499
+
500
+
ARG CATEGORIES="packages"
501
+
502
+
RUN pipenv install --categories="${CATEGORIES}" --skip-lock --system --deploy --verbose
503
+
504
+
ENTRYPOINT python -u $HANDLER
376
505
```
506
+
507
+
And we'll add an ignorefile for this Dockerfile as well.
508
+
509
+
```gitignore
510
+
.mypy_cache/
511
+
.nitric/
512
+
.venv/
513
+
.model/
514
+
```
515
+
516
+
Finally we'll update our `nitric.yaml` to include the new dockerfiles.
517
+
518
+
```yaml
519
+
name: podcast-ai
520
+
services:
521
+
- match: services/*.py
522
+
start: pipenv run dev $SERVICE_PATH
523
+
runtime: standard
524
+
batch-services:
525
+
- match: batches/*.py
526
+
start: pipenv run dev $SERVICE_PATH
527
+
runtime: torch
528
+
529
+
runtimes:
530
+
torch:
531
+
dockerfile: './docker/torch.dockerfile'
532
+
args: {}
533
+
standard:
534
+
dockerfile: './docker/standard.dockerfile'
535
+
args: {}
536
+
537
+
preview:
538
+
- batch-services
539
+
```
540
+
541
+
Finally we can define out nitric stack file for deploying to the cloud.
542
+
543
+
```bash
544
+
nitric stack new aws aws
545
+
```
546
+
547
+
This will generate a nitric stack called `aws` to deploy to AWS.
548
+
549
+
Then we can tweak out stack with settings with some configuration for our batch service and the AWS Compute environment it will run in.
You will need to make sure your machine is configured to deploy to AWS. See
571
+
the [Nitric AWS provider documentation](/providers/aws) for more information.
572
+
</Note>
573
+
574
+
<Note>
575
+
Most AWS accounts will not have access to on demand GPU instances so you may
576
+
need to update your AWS service quotas to allow GPU instances to spin up. The
577
+
model will also work on CPU so if you can't get access to GPUs you can always
578
+
increase the CPU count and memory to compensate.
579
+
</Note>
580
+
581
+
Once that's configured we can deploy our project to the cloud using:
582
+
583
+
```bash
584
+
nitric up
585
+
```
586
+
587
+
<Note>
588
+
Deployment may take sometime due to the size of the python/Nvidia driver and
589
+
CUDA runtime dependencies. Be patient.
590
+
</Note>
591
+
592
+
Once the project is deployed you can try out some generation, just like before depending on the hardware you were running on locally you may notice a speed up in generation time.
593
+
594
+
<Note>
595
+
Running the project in the cloud will incur costs. Make sure to monitor your usage and shut down the project when you're done.
596
+
597
+
Running on g5.xlarge from testing this project will cost ~$0.05/minute of audio you generate. Based on standard EC2 pricing for US regions.
598
+
599
+
</Note>
600
+
601
+
In part two of this guide we'll look at adding an LLM agent to our project to automatically generate scripts for our podcasts from small prompts.
0 commit comments