-
Notifications
You must be signed in to change notification settings - Fork 100
Implement GCP container deployments #275
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
Changes from 25 commits
dbe3f5f
4b1f84d
c70c2ed
f62437a
8a2c2f0
524c825
ed50eb2
10f360b
5318a05
d9a376e
deffe3e
35308cf
de477c1
ecaa9ad
487ace0
f2eb1c5
14d75b9
32a401e
54c8e5c
9c12466
9044990
6364077
f3b590c
4e9987b
4950ff4
4b1edee
f050e94
eb7e1d5
992ce4e
1a69439
7626a9c
5bae394
369b937
5b82d96
3d7c82e
637fc53
294b21b
bf675c6
de5028c
d8f53af
861d476
48b4816
e2702aa
4247f12
63e8507
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| from distutils.core import setup | ||
| from glob import glob | ||
| from pkg_resources import parse_requirements | ||
|
|
||
| with open('requirements.txt') as f: | ||
| requirements = [str(r) for r in parse_requirements(f)] | ||
|
|
||
| setup( | ||
| name='function', | ||
| install_requires=requirements, | ||
| packages=['function'], | ||
| package_dir={'function': '.'}, | ||
| package_data={'function': glob('**', recursive=True)}, | ||
| ) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| ARG BASE_IMAGE | ||
| FROM $BASE_IMAGE | ||
| ARG VERSION | ||
| ENV PYTHON_VERSION=${VERSION} | ||
| ARG TARGET_ARCHITECTURE | ||
|
|
||
| COPY . function/ | ||
|
|
||
| ENV PLATFORM_ARG="" | ||
|
|
||
| RUN pip install --no-cache-dir functions-framework gunicorn \ | ||
| && pip cache purge | ||
|
|
||
| RUN touch function/__init__.py \ | ||
| && if [[ "${TARGET_ARCHITECTURE}" == "arm64" ]]; then \ | ||
| export PLATFORM_ARG="--platform manylinux_2_17_aarch64 --only-binary=:all:"; \ | ||
| fi \ | ||
| && if [[ "${TARGET_ARCHITECTURE}" == "arm64" ]] && test -f "function/requirements.txt.arm.${PYTHON_VERSION}"; then \ | ||
| pip install --no-cache-dir ${PLATFORM_ARG} --target . \ | ||
| -r function/requirements.txt \ | ||
| -r function/requirements.txt.arm.${PYTHON_VERSION} \ | ||
| function/ && \ | ||
| pip cache purge; \ | ||
| elif test -f "function/requirements.txt.${PYTHON_VERSION}"; then \ | ||
| pip install --no-cache-dir ${PLATFORM_ARG} --target . \ | ||
| -r function/requirements.txt \ | ||
| -r function/requirements.txt.${PYTHON_VERSION} \ | ||
| function/ && \ | ||
| pip cache purge; \ | ||
| else \ | ||
| pip install --no-cache-dir ${PLATFORM_ARG} --target . \ | ||
| -r function/requirements.txt \ | ||
| function/ && \ | ||
| pip cache purge; \ | ||
| fi | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
|
|
||
| RUN printf '%s\n' \ | ||
| 'from functions_framework import create_app' \ | ||
| 'app = create_app(target="handler", source="function/handler.py")' \ | ||
| > /ff_app.py | ||
|
|
||
|
|
||
| ENV PYTHONPATH="/" | ||
|
|
||
| CMD ["sh", "-c", "exec gunicorn --bind :${PORT:-8080} --workers ${GUNICORN_WORKERS:-1} --threads ${GUNICORN_THREADS:-8} --timeout 0 ff_app:app"] | ||
|
Comment on lines
+11
to
+38
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: cat -n dockerfiles/gcp/python/Dockerfile.functionRepository: spcl/serverless-benchmarks Length of output: 1422 🏁 Script executed: rg "BASE_IMAGE" --type dockerfile --type txt --type yaml -B 2 -A 2 | head -50Repository: spcl/serverless-benchmarks Length of output: 105 🏁 Script executed: rg "BASE_IMAGE" -B 2 -A 2 | head -100Repository: spcl/serverless-benchmarks Length of output: 5261 🏁 Script executed: rg "gcp.*python" -A 5 -B 5 | grep -i "base\|image" | head -50Repository: spcl/serverless-benchmarks Length of output: 387 🏁 Script executed: find . -name "*.yaml" -o -name "*.yml" -o -name "*.json" | xargs grep -l "gcp" | head -5Repository: spcl/serverless-benchmarks Length of output: 207 🏁 Script executed: rg "gcp.*python" configs/ -B 3 -A 10Repository: spcl/serverless-benchmarks Length of output: 52 🏁 Script executed: find configs -name "*.json" -exec cat {} \; | grep -A 10 -B 10 "gcp" | head -100Repository: spcl/serverless-benchmarks Length of output: 2159 🏁 Script executed: rg "python.*3\." sebs/ -B 3 -A 3 | grep -i "gcp\|base\|image" | head -50Repository: spcl/serverless-benchmarks Length of output: 52 🏁 Script executed: find sebs -name "*.py" | xargs grep -l "gcp.*python" | head -3Repository: spcl/serverless-benchmarks Length of output: 89 🏁 Script executed: rg "python" sebs/faas/gcp.py -B 3 -A 3 | head -50Repository: spcl/serverless-benchmarks Length of output: 127 🏁 Script executed: rg "base_image" sebs/faas/ -B 2 -A 2Repository: spcl/serverless-benchmarks Length of output: 890 🏁 Script executed: rg "benchmark_base_images" sebs/ -B 3 -A 10 | head -80Repository: spcl/serverless-benchmarks Length of output: 1825 🏁 Script executed: rg "benchmark_base_images" sebs/config.py -A 30Repository: spcl/serverless-benchmarks Length of output: 1380 🏁 Script executed: find . -name "*.yaml" -o -name "*.yml" -o -name "*.json" | xargs grep -l "base_images" | head -5Repository: spcl/serverless-benchmarks Length of output: 93 🏁 Script executed: rg "gcp" ./configs/systems.json -B 3 -A 20 | grep -A 20 "python"Repository: spcl/serverless-benchmarks Length of output: 908 🏁 Script executed: rg "USER" dockerfiles/ | grep -v "root"Repository: spcl/serverless-benchmarks Length of output: 1874 🏁 Script executed: rg "USER root" dockerfiles/ -B 5 -A 10Repository: spcl/serverless-benchmarks Length of output: 6699 🏁 Script executed: cat dockerfiles/gcp/java/Dockerfile.function | tail -20Repository: spcl/serverless-benchmarks Length of output: 934 🏁 Script executed: cat dockerfiles/gcp/nodejs/Dockerfile.function | tail -20Repository: spcl/serverless-benchmarks Length of output: 552 Remove The operations in this Dockerfile do not require root privileges. The 🧰 Tools🪛 Trivy (0.69.3)[error] 11-11: Image user should not be 'root' Last USER command in Dockerfile should not be 'root' Rule: DS-0002 (IaC/Dockerfile) 🤖 Prompt for AI Agents |
||
Uh oh!
There was an error while loading. Please reload this page.