Build the Docker image:
docker build -t takehome-stacksync .Run the container:
docker run -p 8080:8080 takehome-stacksynccurl -X POST https://stacksync-python-api-102239670054.us-west1.run.app/execute \
-H "Content-Type: application/json" \
-d '{"script": "def main():\n print(\"hello\")\n return {\"foo\": \"bar\"}"}'{
"result":{
"foo":"bar"
},
"stdout":"hello"
}- Docker
- (For deployment) Google Cloud account with Cloud Run enabled
- Python 3.11
- Flask
- nsjail
def main():
import numpy as np
arr = np.array([1, 2, 3])
print("Array:", arr)
return {"sum": int(arr.sum())}- The GitHub repository URL (public or shared with RubenB1)
- The Google Cloud Run service URL
- 2.5 hours