Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CIMS-4 - Install fastapi and spin up local Hello World application #4

Open
wants to merge 49 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 34 commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
2c7b35d
installed fastapi and uvicorn
sudeepkunhis Dec 4, 2024
421b261
added hello world method
sudeepkunhis Dec 4, 2024
a37b83a
fixed formatting
sudeepkunhis Dec 4, 2024
d7616a8
installed https dev dependency
sudeepkunhis Dec 4, 2024
2d927a2
set hello world response
sudeepkunhis Dec 4, 2024
878c15b
initial test and run pytest using poetry
sudeepkunhis Dec 4, 2024
5632e3f
initial test framework
sudeepkunhis Dec 4, 2024
d09697a
ignored assert lint error
sudeepkunhis Dec 4, 2024
6207553
return type in main
sudeepkunhis Dec 4, 2024
55183d4
ignore assert rule
sudeepkunhis Dec 4, 2024
f49909b
rearranged directory structure
sudeepkunhis Dec 4, 2024
a7e3613
updated lock file
sudeepkunhis Dec 4, 2024
247435e
added make run
sudeepkunhis Dec 4, 2024
b17b305
set the port value
sudeepkunhis Dec 5, 2024
9667ca7
initial docker framework
sudeepkunhis Dec 5, 2024
2bedf4b
initial docker-compose
sudeepkunhis Dec 5, 2024
1dcad16
test commit
sudeepkunhis Dec 5, 2024
dd99ccf
fixed megalint, set poetry version in docker and no cache
sudeepkunhis Dec 5, 2024
0061fbc
cleanup
sudeepkunhis Dec 5, 2024
2db7829
makefile entries to start and stop docker
sudeepkunhis Dec 5, 2024
1740c7f
make commands to start and stop docker
sudeepkunhis Dec 9, 2024
0488ebb
makefile changes
sudeepkunhis Dec 9, 2024
7848e08
makefile changes
sudeepkunhis Dec 9, 2024
161e07d
simplified docker commands
sudeepkunhis Dec 9, 2024
78935e9
empty CODEOWNERS
sudeepkunhis Dec 9, 2024
dd30344
updated ruff
sudeepkunhis Dec 10, 2024
1dd0f1d
updated packages
sudeepkunhis Dec 10, 2024
4c06726
Merge branch 'main' into install-fastapi
sudeepkunhis Dec 10, 2024
84624dc
test commit
sudeepkunhis Dec 10, 2024
169d8c5
test commit
sudeepkunhis Dec 10, 2024
274d101
comments in the makefile
sudeepkunhis Dec 11, 2024
240ccdc
Add instructions for building the Docker image to README
sudeepkunhis Dec 11, 2024
d8dba8a
Update README with Docker container management instructions and disab…
sudeepkunhis Dec 11, 2024
e9fa4d7
Disable Markdown link check in linter configuration and update README…
sudeepkunhis Dec 11, 2024
d88dcd8
test cloud build
sudeepkunhis Dec 16, 2024
c56df7e
test cloud build - 1
sudeepkunhis Dec 16, 2024
a6cd457
test cloud build and deploy
sudeepkunhis Dec 16, 2024
ed6af95
test cloud build and deploy - 1
sudeepkunhis Dec 16, 2024
66edf1d
test cloud build and deploy - 2
sudeepkunhis Dec 16, 2024
fd540d5
pass lint
sudeepkunhis Dec 16, 2024
260b01c
test cloud build with env var
sudeepkunhis Dec 16, 2024
7fda29a
test cloud build with env var - 1
sudeepkunhis Dec 16, 2024
622cfa5
test cloud build with env var - 2
sudeepkunhis Dec 16, 2024
5113f86
test cloud build with env var - 3
sudeepkunhis Dec 16, 2024
1781eba
test cloud build in dev project
sudeepkunhis Dec 17, 2024
2b30d16
set the port value
sudeepkunhis Dec 17, 2024
f0b624d
check unauthenticated
sudeepkunhis Dec 17, 2024
b1f0be8
test cloud build
sudeepkunhis Dec 18, 2024
c3eb283
test cloud build - 1
sudeepkunhis Dec 18, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
11 changes: 11 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM python:3.12.6

WORKDIR /app

COPY pyproject.toml poetry.lock /app/

RUN pip install --no-cache-dir poetry==1.8.4 && poetry install --no-root --no-dev

COPY . /app

CMD ["poetry", "run", "uvicorn", "src.main:app", "--host", "0.0.0.0", "--port", "5010"]
20 changes: 18 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ lint: ## Run all linters (black/ruff/pylint/mypy).

.PHONY: test
test: ## Run the tests and check coverage.
poetry run pytest -n auto --cov=eq_cir_converter_service --cov-report term-missing --cov-fail-under=100
poetry run pytest -n auto --cov=src --cov-report term-missing --cov-fail-under=100

.PHONY: mypy
mypy: ## Run mypy.
poetry run mypy eq_cir_converter_service
poetry run mypy src

.PHONY: install
install: ## Install the dependencies excluding dev.
Expand All @@ -48,3 +48,19 @@ megalint: ## Run the mega-linter.
-v /var/run/docker.sock:/var/run/docker.sock:rw \
-v $(shell pwd):/tmp/lint:rw \
oxsecurity/megalinter:v7

.PHONY: run
run: ## Start the local application.
poetry run uvicorn src.main:app --reload --port 5010

.PHONY: docker-build
docker-build: ## Build the docker image.
docker build -t cir-converter-service .

.PHONY: docker-compose-up
docker-compose-up: ## Start the docker container using docker-compose.
docker-compose up -d

.PHONY: docker-compose-down
docker-compose-down: ## Stop the docker container using docker-compose.
docker-compose down
28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ This repository is for the CIR Converter service Python FastAPI application
- [Development](#development)
- [Run Tests with Coverage](#run-tests-with-coverage)
- [Linting and Formatting](#linting-and-formatting)
- [Build the docker image](#build-the-docker-image)
- [Start the docker container](#start-the-docker-container)
- [View the local application](#view-the-local-application)
- [Stop the docker container](#stop-the-docker-container)
- [Contributing](#contributing)
- [License](#license)
<!-- markdown-link-check-enable -->
Expand Down Expand Up @@ -137,6 +141,30 @@ To start the linter and automatically rectify fixable issues, run:
make megalint
```

### Build the docker image

```bash
make docker-build
```

### Start the docker container

```bash
make docker-compose-up
```

### View the local application

<!-- markdown-link-check-disable-next-line -->
- Navigate to [http://localhost:5010/docs](http://localhost:5010/docs) to view the FastAPI application
sudeepkunhis marked this conversation as resolved.
Show resolved Hide resolved
- View the API endpoints available and test to see the response

### Stop the docker container

```bash
make docker-compose-down
```

## Contributing

See [CONTRIBUTING.md](CONTRIBUTING.md) for details.
Expand Down
7 changes: 7 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
services:
web:
build: .
ports:
- "5010:5010"
volumes:
- .:/app
76 changes: 0 additions & 76 deletions eq_cir_converter_service/calculator.py

This file was deleted.

Loading
Loading