@@ -24,9 +24,12 @@ verify_package() {
2424
2525echo $VERSION
2626if [ -z $ENABLE_PYPI_BUILD ] || [ -z $STABLE_VERSION ]; then
27- echo " $0 pypi-build=enable stable=true"
28- echo " \tpypi-build: Build and publish a new version of the package to pypi. Options are prod or test"
29- echo " \tstable: Only build and publish a new version for the stable docker tag if it has been tested and going on the changelog"
27+ echo " $0 pypi-build=<option> stable=<true|false>"
28+ echo " \tpypi-build: Options are prod, test, or local"
29+ echo " \t - prod: Build and publish to production PyPI, then build Docker images"
30+ echo " \t - test: Build and publish to test PyPI, then build Docker images"
31+ echo " \t - local: Build Docker images only using existing PyPI package (specify prod or test via stable parameter)"
32+ echo " \tstable: true/false - Also tag as stable; for local builds, use 'prod' or 'test' to specify PyPI source"
3033 exit
3134fi
3235
@@ -97,3 +100,31 @@ if [ $STABLE_VERSION = "stable=true" ]; then
97100 && docker push socketdev/cli:stable
98101fi
99102
103+ if [ $ENABLE_PYPI_BUILD = " pypi-build=local" ]; then
104+ echo " Building local version without publishing to PyPI"
105+
106+ # Determine PyPI source based on stable parameter
107+ if [ $STABLE_VERSION = " stable=prod" ]; then
108+ echo " Using production PyPI"
109+ PIP_INDEX_URL=" https://pypi.org/simple"
110+ PIP_EXTRA_INDEX_URL=" https://pypi.org/simple"
111+ TAG_SUFFIX=" local"
112+ elif [ $STABLE_VERSION = " stable=test" ]; then
113+ echo " Using test PyPI"
114+ PIP_INDEX_URL=" https://test.pypi.org/simple"
115+ PIP_EXTRA_INDEX_URL=" https://pypi.org/simple"
116+ TAG_SUFFIX=" local-test"
117+ else
118+ echo " For local builds, use stable=prod or stable=test to specify PyPI source"
119+ exit 1
120+ fi
121+
122+ docker build --no-cache \
123+ --build-arg CLI_VERSION=$VERSION \
124+ --build-arg PIP_INDEX_URL=$PIP_INDEX_URL \
125+ --build-arg PIP_EXTRA_INDEX_URL=$PIP_EXTRA_INDEX_URL \
126+ -t socketdev/cli:$VERSION -$TAG_SUFFIX \
127+ -t socketdev/cli:$TAG_SUFFIX .
128+ echo " Local build complete. Tagged as socketdev/cli:$VERSION -$TAG_SUFFIX and socketdev/cli:$TAG_SUFFIX "
129+ fi
130+
0 commit comments