Skip to content

Commit 75fa66e

Browse files
authored
Static binary (#148)
Make binaries truly static Previously there was a dynamic link to glibc or sth, which was breaking use cases on not strictly FHS-compliant systems
1 parent edd9429 commit 75fa66e

File tree

6 files changed

+52
-7
lines changed

6 files changed

+52
-7
lines changed

.bumpversion.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 1.6.9
2+
current_version = 1.6.10
33
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(-(?P<release>.*))?
44
serialize =
55
{major}.{minor}.{patch}-{release}

.github/workflows/built-test-release.yml

+19-2
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ jobs:
168168
169169
- name: Build package
170170
run: |
171-
mkdir dist
171+
mkdir -p dist
172172
docker run \
173173
-v $(pwd)/dist:/app/dist \
174174
docker.pkg.github.com/$GITHUB_REPOSITORY/dtcli-env:${GITHUB_SHA:0:6} \
@@ -194,7 +194,7 @@ jobs:
194194
195195
- name: Build binary distribution
196196
run: |
197-
mkdir dist
197+
mkdir -p dist
198198
docker run \
199199
-v $(pwd)/dist:/app/dist \
200200
docker.pkg.github.com/$GITHUB_REPOSITORY/dtcli-env:${GITHUB_SHA:0:6} \
@@ -209,6 +209,23 @@ jobs:
209209
run: |
210210
./dist/dt
211211
212+
- name: Make the binary static
213+
run: |
214+
docker run \
215+
-v $(pwd)/dist:/app/dist \
216+
docker.pkg.github.com/$GITHUB_REPOSITORY/dtcli-env:${GITHUB_SHA:0:6} \
217+
poetry run staticx --strip dist/dt dist/dt-static
218+
219+
docker run \
220+
-v $(pwd)/dist:/app/dist \
221+
docker.pkg.github.com/$GITHUB_REPOSITORY/dtcli-env:${GITHUB_SHA:0:6} \
222+
chown $(id -u):$(id -g) dist/dt-static
223+
224+
- name: Sanity
225+
run: |
226+
./dist/dt-static
227+
mv dist/dt-static dist/dt
228+
212229
- name: Cache built linux binary artifact
213230
uses: actions/upload-artifact@v2
214231
with:

Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ FROM python:3.9-slim
22

33
# Install package build system
44
RUN pip install poetry
5-
RUN apt-get update && apt-get install -y binutils
5+
RUN apt-get update && apt-get install -y binutils patchelf
66

77
# Project directory must be mounted in /app
88
WORKDIR /app

dtcli/version.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
__version__ = "1.6.9"
15+
__version__ = "1.6.10"

poetry.lock

+28-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ packages = [
1212
]
1313
readme = "README.md"
1414
repository = "https://github.com/dynatrace-oss/dt-cli"
15-
version = "1.6.9"
15+
version = "1.6.10"
1616

1717

1818
[tool.poetry.dependencies]
@@ -49,6 +49,7 @@ pytest-mock = "^3.5"
4949
pytest-mypy = "^0.8"
5050
radon = "^4.0"
5151
sphinxcontrib-programoutput = "^0.17"
52+
staticx = "^0.13.8"
5253

5354
[build-system]
5455
build-backend = "poetry.core.masonry.api"

0 commit comments

Comments
 (0)