mirror of
https://github.com/anchore/syft.git
synced 2025-11-18 00:43:20 +01:00
Merge pull request #344 from anchore/add-docker-image
Add Docker image to release process
This commit is contained in:
commit
a5ae8e9668
6
.github/workflows/release.yaml
vendored
6
.github/workflows/release.yaml
vendored
@ -83,6 +83,8 @@ jobs:
|
|||||||
needs: [wait-for-checks]
|
needs: [wait-for-checks]
|
||||||
runs-on: macos-latest # Due to our code signing process, it's vital that we run our release steps on macOS.
|
runs-on: macos-latest # Due to our code signing process, it's vital that we run our release steps on macOS.
|
||||||
steps:
|
steps:
|
||||||
|
- uses: docker-practice/actions-setup-docker@v1
|
||||||
|
|
||||||
- uses: actions/setup-go@v2
|
- uses: actions/setup-go@v2
|
||||||
with:
|
with:
|
||||||
go-version: ${{ env.GO_VERSION }}
|
go-version: ${{ env.GO_VERSION }}
|
||||||
@ -104,6 +106,10 @@ jobs:
|
|||||||
${{ runner.os }}-go-${{ env.GO_VERSION }}-${{ hashFiles('**/go.sum') }}-
|
${{ runner.os }}-go-${{ env.GO_VERSION }}-${{ hashFiles('**/go.sum') }}-
|
||||||
${{ runner.os }}-go-${{ env.GO_VERSION }}-
|
${{ runner.os }}-go-${{ env.GO_VERSION }}-
|
||||||
|
|
||||||
|
- name: Bootstrap project dependencies
|
||||||
|
if: steps.bootstrap-cache.outputs.cache-hit != 'true'
|
||||||
|
run: make bootstrap
|
||||||
|
|
||||||
- name: Import GPG key
|
- name: Import GPG key
|
||||||
id: import_gpg
|
id: import_gpg
|
||||||
uses: crazy-max/ghaction-import-gpg@v2
|
uses: crazy-max/ghaction-import-gpg@v2
|
||||||
|
|||||||
@ -90,3 +90,20 @@ brews:
|
|||||||
name: homebrew-syft
|
name: homebrew-syft
|
||||||
homepage: *website
|
homepage: *website
|
||||||
description: *description
|
description: *description
|
||||||
|
|
||||||
|
dockers:
|
||||||
|
-
|
||||||
|
binaries:
|
||||||
|
- syft
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
image_templates:
|
||||||
|
- "anchore/syft:latest"
|
||||||
|
- "anchore/syft:{{ .Tag }}"
|
||||||
|
- "anchore/syft:v{{ .Major }}"
|
||||||
|
- "anchore/syft:v{{ .Major }}.{{ .Minor }}"
|
||||||
|
|
||||||
|
build_flag_templates:
|
||||||
|
- "--build-arg=BUILD_DATE={{.Date}}"
|
||||||
|
- "--build-arg=BUILD_VERSION={{.Version}}"
|
||||||
|
- "--build-arg=VCS_REF={{.FullCommit}}"
|
||||||
|
- "--build-arg=VCS_URL={{.GitURL}}"
|
||||||
|
|||||||
28
Dockerfile
Normal file
28
Dockerfile
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
FROM alpine:latest AS build
|
||||||
|
|
||||||
|
RUN apk --no-cache add ca-certificates
|
||||||
|
|
||||||
|
FROM scratch
|
||||||
|
# needed for version check HTTPS request
|
||||||
|
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
|
||||||
|
|
||||||
|
# create the /tmp dir, which is needed for image content cache
|
||||||
|
WORKDIR /tmp
|
||||||
|
|
||||||
|
COPY syft /
|
||||||
|
|
||||||
|
ARG BUILD_DATE
|
||||||
|
ARG BUILD_VERSION
|
||||||
|
ARG VCS_REF
|
||||||
|
ARG VCS_URL
|
||||||
|
|
||||||
|
LABEL org.label-schema.schema-version="1.0"
|
||||||
|
LABEL org.label-schema.build-date=$BUILD_DATE
|
||||||
|
LABEL org.label-schema.name="syft"
|
||||||
|
LABEL org.label-schema.description="CLI tool and library for generating a Software Bill of Materials from container images and filesystems"
|
||||||
|
LABEL org.label-schema.vcs-url=$VCS_URL
|
||||||
|
LABEL org.label-schema.vcs-ref=$VCS_REF
|
||||||
|
LABEL org.label-schema.vendor="Anchore, Inc."
|
||||||
|
LABEL org.label-schema.version=$BUILD_VERSION
|
||||||
|
|
||||||
|
ENTRYPOINT ["/syft"]
|
||||||
12
Makefile
12
Makefile
@ -78,10 +78,6 @@ help:
|
|||||||
ci-bootstrap:
|
ci-bootstrap:
|
||||||
DEBIAN_FRONTEND=noninteractive sudo apt update && sudo -E apt install -y bc jq libxml2-utils
|
DEBIAN_FRONTEND=noninteractive sudo apt update && sudo -E apt install -y bc jq libxml2-utils
|
||||||
|
|
||||||
.PHONY:
|
|
||||||
ci-bootstrap-mac:
|
|
||||||
github_changelog_generator --version || sudo gem install github_changelog_generator
|
|
||||||
|
|
||||||
.PHONY: bootstrap
|
.PHONY: bootstrap
|
||||||
bootstrap: ## Download and install all go dependencies (+ prep tooling in the ./tmp dir)
|
bootstrap: ## Download and install all go dependencies (+ prep tooling in the ./tmp dir)
|
||||||
$(call title,Bootstrapping dependencies)
|
$(call title,Bootstrapping dependencies)
|
||||||
@ -226,8 +222,9 @@ acceptance-test-rpm-package-install: $(SNAPSHOTDIR)
|
|||||||
.PHONY: changlog-release
|
.PHONY: changlog-release
|
||||||
changelog-release:
|
changelog-release:
|
||||||
@echo "Last tag: $(SECOND_TO_LAST_TAG)"
|
@echo "Last tag: $(SECOND_TO_LAST_TAG)"
|
||||||
@echo "Current tag: $(VERSION)"
|
@docker run --rm \
|
||||||
@github_changelog_generator \
|
-v "$(shell pwd)":/usr/local/src/your-app \
|
||||||
|
ferrarimarco/github-changelog-generator \
|
||||||
--user anchore \
|
--user anchore \
|
||||||
--project $(BIN) \
|
--project $(BIN) \
|
||||||
-t ${GITHUB_TOKEN} \
|
-t ${GITHUB_TOKEN} \
|
||||||
@ -259,7 +256,7 @@ changelog-unreleased: ## show the current changelog that will be produced on the
|
|||||||
/CHANGELOG.md
|
/CHANGELOG.md
|
||||||
|
|
||||||
.PHONY: release
|
.PHONY: release
|
||||||
release: clean-dist ci-bootstrap-mac changelog-release ## Build and publish final binaries and packages. Intended to be run only on macOS.
|
release: clean-dist changelog-release ## Build and publish final binaries and packages. Intended to be run only on macOS.
|
||||||
$(call title,Publishing release artifacts)
|
$(call title,Publishing release artifacts)
|
||||||
|
|
||||||
# Prepare for macOS-specific signing process
|
# Prepare for macOS-specific signing process
|
||||||
@ -284,6 +281,7 @@ release: clean-dist ci-bootstrap-mac changelog-release ## Build and publish fina
|
|||||||
# upload the version file that supports the application version update check (excluding pre-releases)
|
# upload the version file that supports the application version update check (excluding pre-releases)
|
||||||
.github/scripts/update-version-file.sh "$(DISTDIR)" "$(VERSION)"
|
.github/scripts/update-version-file.sh "$(DISTDIR)" "$(VERSION)"
|
||||||
|
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
clean: clean-dist clean-snapshot ## Remove previous builds and result reports
|
clean: clean-dist clean-snapshot ## Remove previous builds and result reports
|
||||||
rm -rf $(RESULTSDIR)/*
|
rm -rf $(RESULTSDIR)/*
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user