This project provides a simple API for uploading files. It includes Docker support, Conda environment management, and deployment instructions for Google Cloud.
- Docker
- Conda
- Google Cloud SDK
-
Clone the repository:
git clone https://github.com/yourusername/file_upload_api.git cd file_upload_api -
Build and run the Docker container:
docker build -t file_upload_api . docker run -p 4000:80 file_upload_api -
Set up the Conda environment:
conda env create -f environment.yml conda activate file_upload_api
-
Run the application:
uvicorn main:app --host 0.0.0.0 --port 8080 --reload
To run the tests, use the following command:
pytest tests/test_main.py-
Authenticate with Google Cloud:
gcloud auth application-default login --impersonate-service-account osama.m7@gmail.com gcloud auth login gcloud auth application-default login
-
Build and push the Docker image to Google Container Registry:
docker build -t gcr.io/api-project-451928270458/file_upload_api . docker push gcr.io/api-project-451928270458/file_upload_api -
Deploy the application on Google Cloud:
gcloud run deploy file_upload_api --image gcr.io/api-project-451928270458/file_upload_api --platform managed
UNLICENSED
Commands:
docker run -p 4000:80 file_upload_api
conda activate file_upload_api
conda env update -f environment.yml
uvicorn main:app --host 0.0.0.0 --port 8080 --reload
gcloud
pytest tests/test_main.py
gcloud auth application-default login --impersonate-service-account <email>
gcloud auth login
gcloud auth application-default login
docker build -t gcr.io/{projectId}/file_upload_api .
docker push gcr.io/{projectId}/file_upload_api