Some checks failed
Gitea Actions Demo Training / Explore-Gitea-Actions (push) Failing after 14s
794 B
794 B
Exercise — writing Dockerfiles
-
Check out the code repository:
git clone https://git.verleun.org/training/docker-build-exercise.git -
Add a
Dockerfilethat will build the image:-
Use
python:3.9.9-slim-bullseyeas the base image (FROMline) -
Expose port 8000 (
EXPOSE) -
Installs files in '/usr/local/app' (
WORKDIR) -
Execute the command
uvicorn app:api --host 0.0.0.0 --port 8000
-
-
Build the image with
docker build -t exercise:1 . -
Run the image:
docker run -d -p 8123:8000 exercise:1
Again, with docker-compose (optional)
Create a docker-compose.yml with the following content:
version: "3"
services:
app:
build: .
ports:
- 8123:8000
Start the container: docker-compose up -d