Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Git
.git
.gitignore
.github

# Python
__pycache__
*.py[cod]
*$py.class
*.so
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
venv/
env/
ENV/

# Testing
.pytest_cache/
.coverage
htmlcov/
tests/
tests_*/
test_external_plugins/
conftest.py

# IDE
.vscode/
.idea/
*.swp
*.swo
*~

# Documentation
docs/
*.md
!README.md

# CI/CD
.pre-commit-config.yaml

# Other
*.log
.DS_Store
scripts/
snyk/
performance_history_analysis.py
27 changes: 27 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# step 1 - build the cli
FROM python:3.10-slim AS builder
WORKDIR /build
RUN apt-get update && apt-get install -y \
gcc \
g++ \
libffi-dev \
libssl-dev \
git \
&& rm -rf /var/lib/apt/lists/*

COPY pyproject.toml ./
COPY README.md ./
COPY LICENSE ./
COPY src ./src

RUN pip install --no-cache-dir hatch && hatch build -t wheel

# step 2 - package the cli to a minimal image
FROM python:3.10-slim
RUN apt-get update && apt-get install -y libssl3 && rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY --from=builder /build/dist/*.whl /tmp/
RUN pip install --no-cache-dir /tmp/*.whl && rm -rf /tmp/*.whl
ENV SF_SKIP_WARNING_FOR_READ_PERMISSIONS_ON_CONFIG_FILE=true
ENTRYPOINT ["snow"]
CMD ["--help"]
24 changes: 24 additions & 0 deletions build-docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash

SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"

echo "Building snow-cli Docker image..."
echo "======================================="

docker build --progress=plain -t snow-cli "$SCRIPT_DIR"

if [ $? -eq 0 ]; then
echo ""
echo "======================================="
echo "Build successful!"
echo "Image: snow-cli:latest"
echo ""
echo "Usage:"
echo " docker run --rm snow-cli --version"
echo " docker run --rm snow-cli --help"
else
echo ""
echo "======================================="
echo "Build failed!"
exit 1
fi
Loading