-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SNOW-1055755: use docker to build linux packages
- Loading branch information
1 parent
43bfe9f
commit e04d465
Showing
7 changed files
with
84 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
FROM python:3.11-bookworm | ||
|
||
RUN apt update | ||
RUN apt upgrade -y | ||
RUN apt install -y ruby squashfs-tools rpm | ||
RUN gem install fpm | ||
RUN pip install -U pip uv hatch | ||
|
||
WORKDIR /snowflake-cli | ||
RUN git clone https://github.com/snowflakedb/snowflake-cli.git . |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/env bash | ||
set -o pipefail | ||
|
||
VERSION=$(hatch version) | ||
|
||
hatch -e packaging run pyinstaller \ | ||
--name=snow \ | ||
--onedir \ | ||
--clean \ | ||
--noconfirm \ | ||
--contents-directory=snowflake-cli-${VERSION} \ | ||
src/snowflake/cli/app/__main__.py |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/bin/env bash | ||
set -o pipefail | ||
|
||
VERSION=$(hatch version) | ||
THIS_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | ||
DEB_PGK="snowflke-cli-${VERSION}.deb" | ||
RPM_PGK="snowflke-cli-${VERSION}.rpm" | ||
|
||
fpm \ | ||
-s dir \ | ||
-t deb \ | ||
--name snow \ | ||
--version ${VERSION} \ | ||
-p DEB_PGK \ | ||
-C ./dist/snow \ | ||
--prefix /usr/lib/snowflake/snowflake-cli \ | ||
--after-install $THIS_DIR/ubuntu/after_install.sh \ | ||
--after-remove $THIS_DIR/ubuntu/after_remove.sh \ | ||
--force | ||
|
||
fpm \ | ||
-s dir \ | ||
-t rpm \ | ||
--name snow \ | ||
--version ${VERSION} \ | ||
-p RPM_PGK \ | ||
-C ./dist/snow \ | ||
--prefix /usr/lib/snowflake/snowflake-cli \ | ||
--after-install $THIS_DIR/ubuntu/after_install.sh \ | ||
--after-remove $THIS_DIR/ubuntu/after_remove.sh \ | ||
--force |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
services: | ||
package-builder: | ||
build: . | ||
volumes: | ||
- ../../:/snowflake-cli |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/bash -e | ||
# | ||
# Snowcd after install script | ||
set -o pipefail | ||
|
||
SNOWFLAKE_CLI_LINK=/usr/local/bin/snow | ||
SNOWFLAKE_CLI_BIN=/usr/lib/snowflake/snowflake-cli/snow | ||
rm -f ${SNOWFLAKE_CLI_LINK} | ||
ln -s ${SNOWFLAKE_CLI_BIN} ${SNOWFLAKE_CLI_LINK} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash -e | ||
# | ||
# Snowcd after remove script | ||
# | ||
set -o pipefail | ||
|
||
SNOWFLAKE_CLI_LINK=/usr/local/bin/snow | ||
if [[ -L "${SNOWFLAKE_CLI_LINK}" ]]; then | ||
# delete only if it is symlink | ||
rm -f "${SNOWFLAKE_CLI_LINK}" | ||
fi |