Hi! Is it possible to build and deploy only one ce...
# help
a
Hi! Is it possible to build and deploy only one certain stack?
npx sst diff dev-sst-Stack --stage dev
does deploy only
dev-sst-Stack
but it builds all 100 others as wel
I trying to deploy stacks in parallel on Gitlab, but what the point if every job builds all stacks))
a
I guess cdk does that by default because it needs to know all references, and deploys only what you tell him to deploy. Indeed it can get slow because of lambdas or docker images if you use those 😅
a
yeap, docker is the one i want to run separatly
a
I might have a solution (haven't tried it yet). You can reference an image from a tarball with
Copy code
ecs.ContainerImage.fromTarball(file)
where the tarball can be generated after building a Docker image with
Copy code
docker save
https://docs.docker.com/engine/reference/commandline/save/ This way you can build the image separately and cache layers using CI
a
My problem is this guy:
Copy code
new Function(this, "categorization", {
            handler: "lala.lala_handler",
            runtime: "python3.9",
        });
And it build inside container....
a
ohh
hmmm
seems like someone else reported this (exactly with python) and there is a cli arg
skip: true
in CDK for this (see this test). However I'm not sure if sst passes this command down
there's also this section in the cdk cli guide
a
skipping is complicated...
f
@Aleksandr Matrosov we’ve got a couple of things on the roadmap that could fix this: • possible fix 1: only building Functions in the stack to be deployed https://github.com/serverless-stack/serverless-stack/issues/1755 • possible fix 2: run
sst build
once, and
sst deploy
reuse the built artifact, instead of building again https://github.com/serverless-stack/serverless-stack/issues/779
I bumped up the priority for both issues.
For now, here’s a work around. Define ur stack like this:
Copy code
const STACK = process.env.STACK;

(!STACK || STACK === "StackA") && app.stack(StackA);
(!STACK || STACK === "StackB") && app.stack(StackB);
(!STACK || STACK === "StackC") && app.stack(StackC);
And this will only build and deploy a single stack
Copy code
STACK=StackA sst deploy
And this will deploy all stacks
Copy code
sst deploy
Hope that helps 😁
k
@Frank regarding Python builds, I know that e.g. serverless-python-requirements provides an option to determine the need for docker based on the underlying OS.
Copy code
pythonRequirements:
    dockerizePip: non-linux
To my mind most CI/CD systems aren't running on Windows platforms. Could we potentially get a feature that simply allows to zip up a .venv library folder in Linux / OSX systems with CDK? This would speed up the process even further to my mind.