Skip to content

Commit 20ccf9d

Browse files
committed
added multi-platform docker build
1 parent 3cbbf53 commit 20ccf9d

File tree

4 files changed

+49
-12
lines changed

4 files changed

+49
-12
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99
### Added
1010
- Upcoming changes...
1111

12+
## [1.2.2] - 2022-11-18
13+
### Added
14+
- Added SSL cert error ignore option (--ignore-cert-errors) for REST calls
15+
Custom certificates can be supplied using environment variables
16+
- Added multi-platform Docker images (AMD64 & ARM64)
17+
1218
## [1.2.1] - 2022-11-11
1319
### Added
1420
- Added sub-command (file_count)to produce a file summary (extensions & size) into a CSV
@@ -134,3 +140,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
134140
[1.1.1]: https://github.com/scanoss/scanoss.py/compare/v1.1.0...v1.1.1
135141
[1.2.0]: https://github.com/scanoss/scanoss.py/compare/v1.1.1...v1.2.0
136142
[1.2.1]: https://github.com/scanoss/scanoss.py/compare/v1.2.0...v1.2.1
143+
[1.2.2]: https://github.com/scanoss/scanoss.py/compare/v1.2.1...v1.2.2

Dockerfile

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM python:3.8-slim-buster as base
1+
FROM python:3.10-slim-buster as base
22

33
LABEL maintainer="SCANOSS <[email protected]>"
44

@@ -16,14 +16,20 @@ ENV PATH=/root/.local/bin:$PATH
1616

1717
COPY ./dist/scanoss-*-py3-none-any.whl /install/
1818

19-
#RUN pip3 install --user scanoss
2019
RUN pip3 install --user /install/scanoss-*-py3-none-any.whl
2120
RUN pip3 install --user scancode-toolkit-mini
22-
RUN pip3 install --user typecode-libmagic
21+
#RUN pip3 install --user typecode-libmagic
22+
23+
# Download compile and install typecode-libmagic from source (as there is not ARM wheel available)
24+
ADD https://github.com/nexB/typecode_libmagic_from_sources/archive/refs/tags/v5.39.210212.tar.gz /install/
25+
RUN tar -xvzf /install/v5.39.210212.tar.gz -C /install \
26+
&& cd /install/typecode_libmagic_from_sources* \
27+
&& ./build.sh && python3 setup.py sdist bdist_wheel \
28+
&& pip3 install --user `ls /install/typecode_libmagic_from_sources*/dist/*.whl`
2329

2430
# Remove license data references as they are not required for dependency scanning (to save space)
25-
RUN rm -rf /root/.local/lib/python3.8/site-packages/licensedcode/data/rules /root/.local/lib/python3.8/site-packages/licensedcode/data/cache
26-
RUN mkdir /root/.local/lib/python3.8/site-packages/licensedcode/data/rules /root/.local/lib/python3.8/site-packages/licensedcode/data/cache
31+
RUN rm -rf /root/.local/lib/python3.10/site-packages/licensedcode/data/rules /root/.local/lib/python3.10/site-packages/licensedcode/data/cache
32+
RUN mkdir /root/.local/lib/python3.10/site-packages/licensedcode/data/rules /root/.local/lib/python3.10/site-packages/licensedcode/data/cache
2733

2834
FROM base
2935

Makefile

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,19 @@ publish: ## Publish Python package to PyPI
5151
@echo "Publishing package to PyPI..."
5252
twine upload dist/*
5353

54-
package_all: dist publish ## Build & Publish Python package to PyPI
54+
package_all: dist publish ## Build & Publish Python package to PyPI
5555

56-
ghcr_build: dist ## Build GitHub container image
56+
ghcr_build: dist ## Build GitHub container image with local arch
5757
@echo "Building GHCR container image..."
58-
docker build --no-cache -t $(GHCR_FULLNAME) --platform linux/amd64 .
58+
docker build -t $(GHCR_FULLNAME) .
59+
60+
ghcr_amd64: dist ## Build GitHub AMD64 container image
61+
@echo "Building GHCR AMD64 container image..."
62+
docker build -t $(GHCR_FULLNAME) --platform linux/amd64 .
63+
64+
ghcr_arm64: dist ## Build GitHub ARM64 container image
65+
@echo "Building GHCR ARM64 container image..."
66+
docker build -t $(GHCR_FULLNAME) --platform linux/arm64 .
5967

6068
ghcr_tag: ## Tag the latest GH container image with the version from Python
6169
@echo "Tagging GHCR latest image with $(VERSION)..."
@@ -66,12 +74,24 @@ ghcr_push: ## Push the GH container image to GH Packages
6674
docker push $(GHCR_FULLNAME):$(VERSION)
6775
docker push $(GHCR_FULLNAME):latest
6876

69-
ghcr_all: ghcr_build ghcr_tag ghcr_push ## Execute all GitHub Package container actions
77+
ghcr_release: dist ## Build/Publish GitHub multi-platform container image
78+
@echo "Building & Releasing GHCR multi-platform container image $(VERSION)..."
79+
docker buildx build --push -t $(GHCR_FULLNAME):$(VERSION) --platform linux/arm64,linux/amd64 .
80+
81+
ghcr_all: ghcr_release ## Execute all GHCR container actions
7082

71-
docker_build: ## Build Docker container image
83+
docker_build: ## Build Docker container image with local arch
7284
@echo "Building Docker image..."
7385
docker build --no-cache -t $(DOCKER_FULLNAME) .
7486

87+
docker_amd64: dist ## Build Docker AMD64 container image
88+
@echo "Building Docker AMD64 container image..."
89+
docker build -t $(DOCKER_FULLNAME) --platform linux/amd64 .
90+
91+
docker_arm64: dist ## Build Docker ARM64 container image
92+
@echo "Building Docker ARM64 container image..."
93+
docker build -t $(DOCKER_FULLNAME) --platform linux/arm64 .
94+
7595
docker_tag: ## Tag the latest Docker container image with the version from Python
7696
@echo "Tagging Docker latest image with $(VERSION)..."
7797
docker tag $(DOCKER_FULLNAME):latest $(DOCKER_FULLNAME):$(VERSION)
@@ -81,4 +101,8 @@ docker_push: ## Push the Docker container image to DockerHub
81101
docker push $(DOCKER_FULLNAME):$(VERSION)
82102
docker push $(DOCKER_FULLNAME):latest
83103

84-
docker_all: docker_build docker_tag docker_push ## Execute all DockerHub container actions
104+
docker_release: dist ## Build/Publish Docker multi-platform container image
105+
@echo "Building & Releasing Docker multi-platform container image $(VERSION)..."
106+
docker buildx build --push -t $(DOCKER_FULLNAME):$(VERSION) --platform linux/arm64,linux/amd64 .
107+
108+
docker_all: docker_release ## Execute all DockerHub container actions

src/scanoss/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@
2222
THE SOFTWARE.
2323
"""
2424

25-
__version__ = '1.2.1'
25+
__version__ = '1.2.2'

0 commit comments

Comments
 (0)