Created
May 30, 2022 20:42
-
-
Save rockyburt/eb80262d871dbe3440ce780cf1eafe07 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/Dockerfile.build b/Dockerfile.build | |
index acfcdd9..28cb8b3 100644 | |
--- a/Dockerfile.build | |
+++ b/Dockerfile.build | |
@@ -13,6 +13,6 @@ RUN \ | |
libpq-dev \ | |
# Poetry deps | |
libffi-dev \ | |
- && \ | |
+ && \ | |
# update PIP | |
- /usr/local/bin/python -m pip install --upgrade pip poetry | |
+ /usr/local/bin/python -m pip install --upgrade pip | |
diff --git a/build.cue b/build.cue | |
index ca96bfd..82651d1 100644 | |
--- a/build.cue | |
+++ b/build.cue | |
@@ -33,16 +33,18 @@ import ( | |
dest: "/app/src" | |
contents: source | |
} | |
- always: true | |
workdir: "/app/src" | |
script: contents: """ | |
- mkdir -p /whl | |
- poetry export --dev --without-hashes --format=requirements.txt > /whl/requirements.txt | |
- pip wheel -w /whl/wheels -r /whl/requirements.txt | |
+ set -e | |
+ mkdir -p /app/build/wheels | |
+ pip wheel -w /app/build/wheels poetry wheel setuptools | |
+ pip install -f /app/build/wheels poetry wheel setuptools | |
+ poetry export --dev --without-hashes --format=requirements.txt > /app/build/requirements.txt | |
+ pip wheel -w /app/build/wheels -r /app/build/requirements.txt | |
""" | |
export: { | |
- directories: "/whl": {} | |
+ directories: "/app/build": _ | |
} | |
} | |
- output: _run.export.directories."/whl" | |
+ output: _run.export.directories."/app/build" | |
} | |
diff --git a/main.cue b/main.cue | |
index a4f3714..8f916d9 100644 | |
--- a/main.cue | |
+++ b/main.cue | |
@@ -5,9 +5,11 @@ import ( | |
"dagger.io/dagger/core" | |
"universe.dagger.io/bash" | |
"universe.dagger.io/docker" | |
+ "universe.dagger.io/docker/cli" | |
) | |
dagger.#Plan & { | |
+ client: network: "unix:///var/run/docker.sock": connect: dagger.#Socket | |
_base: core.#Source & { | |
path: "." | |
exclude: ["cue.mod", "README.md", "*.cue"] | |
@@ -32,9 +34,8 @@ dagger.#Plan & { | |
tag: "app:build-py3.11-rc" | |
}, | |
bash.#Run & { | |
- always: true | |
script: contents: """ | |
- python3 -m venv /app | |
+ python3 -m venv /app/.venv | |
""" | |
}, | |
bash.#Run & { | |
@@ -44,18 +45,30 @@ dagger.#Plan & { | |
contents: _base.output | |
} | |
wheels: { | |
- dest: "/whl" | |
+ dest: "/app/build" | |
contents: buildWheels.output | |
} | |
} | |
- always: true | |
script: contents: """ | |
- /app/bin/python -m pip install --upgrade pip | |
- /app/bin/pip install -r /whl/requirements.txt -f /whl/wheels | |
+ /app/.venv/bin/pip install -r /app/build/requirements.txt -f /app/build/wheels | |
""" | |
}, | |
+ docker.#Set & { | |
+ config: cmd: ["/app/.venv/bin/python3", "/app/src/app.py"] | |
+ }, | |
+ docker.#Copy & { | |
+ contents: _base.output | |
+ dest: "/app/src" | |
+ } | |
] | |
} | |
+ saveLocal: cli.#Load & { | |
+ // save to local docker environment as a debugging artifact | |
+ image: makeApp.output | |
+ host: client.network."unix:///var/run/docker.sock".connect | |
+ tag: "pythonapp:1" | |
+ } | |
+ | |
publishApp: docker.#Push & { | |
image: makeApp.output | |
dest: "localhost:5042/pythonapp:1" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment