From 563313cd5ea2ce12a8a8f49b9176dcbd8b52fce2 Mon Sep 17 00:00:00 2001 From: Joseph Micheli Date: Fri, 8 Dec 2023 17:10:47 -0600 Subject: [PATCH] :hammer: Modify scripts to support building on windows (#211) --- scripts/lib | 6 +++++- scripts/release/build-docker.ps1 | 16 ++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 scripts/release/build-docker.ps1 diff --git a/scripts/lib b/scripts/lib index 17fd9f654..5d53e9a35 100644 --- a/scripts/lib +++ b/scripts/lib @@ -22,7 +22,11 @@ create_dummy_rust_file() { # it's a bit of a hack, but it works lol prisma_sed_correction() { set -ex; \ - sed -i 's|\/.*\/core\/prisma\/schema.prisma|\/app\/core\/prisma\/schema.prisma|g' core/src/prisma.rs; \ + # Match windows paths + sed -i 's|[A-Z]:\\\\.*\\\\core\\\\prisma\\\\schema\.prisma|\/app\/core\/prisma\/schema.prisma|g' core/src/prisma.rs; \ + sed -i 's|[A-Z]:\\\\.*\\\\core\\\\prisma\\\\migrations|\/app\/core\/prisma\/migrations|g' core/src/prisma.rs; \ + # Match Unix paths + sed -i 's|\/.*\/core\/prisma\/schema\.prisma|\/app\/core\/prisma\/schema.prisma|g' core/src/prisma.rs; \ sed -i 's|\/.*\/core\/prisma\/migrations|\/app\/core\/prisma\/migrations|g' core/src/prisma.rs } diff --git a/scripts/release/build-docker.ps1 b/scripts/release/build-docker.ps1 new file mode 100644 index 000000000..ed44549e1 --- /dev/null +++ b/scripts/release/build-docker.ps1 @@ -0,0 +1,16 @@ +# Set default values for arguments if they are not provided +$FORMAT = if ($args[0]) { $args[0] } else { "auto" } +$PLATFORMS = if ($args[1]) { $args[1] } else { "linux/amd64" } +$TAG = if ($args[2]) { $args[2] } else { "nightly" } + +# Get the current Git revision +$GIT_REV = git rev-parse --short HEAD + +# Build the Docker image +docker buildx build ` + -f ./scripts/release/Dockerfile.debian ` + --load ` + --progress=$FORMAT ` + --platform=$PLATFORMS ` + -t aaronleopold/stump:$TAG ` + --build-arg GIT_REV=$GIT_REV .