Created
September 15, 2023 14:51
-
-
Save jpadams/de642b69c888dc998b5db6fe09532b42 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
import sys | |
import anyio | |
import dagger | |
async def test(): | |
async with dagger.Connection(dagger.Config(log_output=sys.stderr)) as client: | |
src = client.host().directory(".") | |
build = ( | |
client.container() | |
.from_("python:3.11.3-bullseye") | |
.with_directory("/src", src) | |
.with_workdir("/src") | |
.with_exec(["pip", "install", "--upgrade", "pip"]) | |
.with_exec(["pip", "install", "--no-cache-dir", "awscli", "aws-sam-cli"]) | |
.with_exec(["apt", "update"]) | |
.with_exec(["apt", "install", "-y", "wget", "curl", "ffmpeg", "libsm6", "libxext6", "ca-certificates", "gnupg", "lsb-release"]) | |
.with_exec(["/bin/sh", "-c", "curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg"]) | |
.with_exec(["/bin/sh", "-c", "echo \"deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian $(lsb_release -cs) stable\" | tee /etc/apt/sources.list.d/docker.list > /dev/null"]) | |
.with_exec(["apt-get", "update"]) | |
.with_exec(["apt", "install", "-y", "docker-ce-cli"]) | |
.with_exec(["/bin/sh", "-c", "curl -L \"https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)\" -o /usr/local/bin/docker-compose"]) | |
.with_exec(["/bin/sh", "-c", "chmod +x /usr/local/bin/docker-compose"]) | |
.with_exec(["pip", "install", "playwright"]) | |
.with_exec(["apt-get", "update"]) | |
.with_exec(["playwright", "install"]) | |
.with_exec(["playwright", "install-deps"]) | |
) | |
# execute | |
results = await build.stdout() | |
print(results) | |
if __name__ == "__main__": | |
anyio.run(test) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment