Skip to content

osalama7/file_upload_api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

File Upload API

This project provides a simple API for uploading files. It includes Docker support, Conda environment management, and deployment instructions for Google Cloud.

Getting Started

Prerequisites

  • Docker
  • Conda
  • Google Cloud SDK

Installation

  1. Clone the repository:

    git clone https://github.com/yourusername/file_upload_api.git
    cd file_upload_api
  2. Build and run the Docker container:

    docker build -t file_upload_api .
    docker run -p 4000:80 file_upload_api
  3. Set up the Conda environment:

    conda env create -f environment.yml
    conda activate file_upload_api
  4. Run the application:

    uvicorn main:app --host 0.0.0.0 --port 8080 --reload

Running Tests

To run the tests, use the following command:

pytest tests/test_main.py

Deployment

  1. Authenticate with Google Cloud:

    gcloud auth application-default login --impersonate-service-account osama.m7@gmail.com
    gcloud auth login
    gcloud auth application-default login
  2. 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
  3. Deploy the application on Google Cloud:

    gcloud run deploy file_upload_api --image gcr.io/api-project-451928270458/file_upload_api --platform managed

License

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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors