Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
51 changes: 51 additions & 0 deletions src/flask-api/.devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"name": "Workbench JupyterLab with docker support devcontainer template",
"dockerComposeFile": "docker-compose.yaml",
"service": "app",
"shutdownAction": "none",
"workspaceFolder": "/workspace",
// Get the host's docker group ID and propagate it into the .env file, which
// allows it to be used within docker-compose.yaml.
"initializeCommand": "DOCKER_GID=`getent group docker | cut -d: -f3` && echo \"DOCKER_GID=${DOCKER_GID}\" > .env",
"postCreateCommand": "./startupscript/post-startup.sh jupyter /home/jupyter ${templateOption:cloud} ${templateOption:login} && ./startupscript/setup-docker.sh",
// re-mount bucket files on container start up
"postStartCommand": [
"./startupscript/remount-on-restart.sh",
"jupyter",
"/home/jupyter",
"${templateOption:cloud}",
"${templateOption:login}"
],
"remoteUser": "root",
"customizations": {
"workbench": {
"opens": {
"extensions": [
// Source
".ipynb",
".R",
".py",
// Documents
".md",
".html",
".latex",
".pdf",
// Images
".bmp",
".gif",
".jpeg",
".jpg",
".png",
".svg",
// Data
".csv",
".tsv",
".json",
".vl"
],
"fileUrlSuffix": "/lab/tree/{path}",
"folderUrlSuffix": "/lab/tree/{path}"
}
}
}
}
23 changes: 23 additions & 0 deletions src/flask-api/devcontainer-template.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"id": "custom-workbench-jupyter-template",
"description": "A template used to serve the Workbench JupyterLab container image",
"version": "0.0.1",
"name": "Workbench Prebuilt JupyterLab Template",
"documentationURL": "https://github.com/verily-src/workbench-app-devcontainers/tree/master/src/custom-workbench-jupyter-template",
"licenseURL": "https://github.com/verily-src/workbench-app-devcontainers/blob/master/LICENSE",
"options": {
"cloud": {
"type": "string",
"description": "VM cloud environment",
"proposals": ["gcp", "aws"],
"default": "gcp"
},
"login": {
"type": "string",
"description": "Whether to log in to workbench CLI",
"proposals": ["true", "false"],
"default": "false"
}
},
"platforms": ["Any"]
}
22 changes: 22 additions & 0 deletions src/flask-api/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
version: "2.4"
services:
app:
container_name: "flask-api-server"
image: "us-central1-docker.pkg.dev/vwb-dev-sleek-haricot-1095/exfil-test-repo/test1:20250728"
user: "jupyter"
restart: always
volumes:
- .:/workspace:cached
ports:
- "8888:8888"
networks:
- app-network
cap_add:
- SYS_ADMIN
devices:
- /dev/fuse
security_opt:
- apparmor:unconfined
networks:
app-network:
external: true
17 changes: 17 additions & 0 deletions src/flask-api/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM python:3.10-slim

# System dependencies (optional: add more as needed)
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
&& rm -rf /var/lib/apt/lists/*

# Copy requirements
COPY requirements.txt /tmp/requirements.txt
RUN pip install --upgrade pip && pip install -r /tmp/requirements.txt

# Copy application code
WORKDIR /workspace/app
COPY app /workspace/app

# Expose Flask app
CMD ["flask", "run", "--host=0.0.0.0", "--port=5000"]
10 changes: 10 additions & 0 deletions src/flask-api/docker/app/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from flask import Flask, jsonify

app = Flask(__name__)

@app.route("/", methods=["GET"])
def hello():
return jsonify({"message": "Hello from Flask API!"})

if __name__ == "__main__":
app.run(host="0.0.0.0", port=5000)
1 change: 1 addition & 0 deletions src/flask-api/docker/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Flask==3.0.0