From 6087cffed9457341316dc876ed2558c38ff3fe97 Mon Sep 17 00:00:00 2001 From: Xinyi Wang Date: Mon, 13 May 2024 12:38:51 -0700 Subject: [PATCH] add license file --- .github/workflows/build.yml | 11 +++++++++++ Dockerfile | 6 ++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4606867..2e97d3f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -101,6 +101,7 @@ jobs: CGO_ENABLED: 0 run: | mkdir dist out + cp LICENSE dist/LICENSE.txt go build -o dist/ -ldflags "-s -w -X $(go list -m)/version.GitCommit=$(git rev-parse --short HEAD)" . zip -r -j out/${{ env.PKG_NAME }}_${{ needs.get-product-version.outputs.product-version }}_${{ matrix.goos }}_${{ matrix.goarch }}.zip dist/ @@ -138,6 +139,7 @@ jobs: CGO_ENABLED: 0 run: | mkdir dist out + cp LICENSE dist/LICENSE.txt go build -o dist/ -ldflags "-s -w -X $(go list -m)/version.GitCommit=$(git rev-parse --short HEAD)" . zip -r -j out/${{ env.PKG_NAME }}_${{ needs.get-product-version.outputs.product-version }}_${{ matrix.goos }}_${{ matrix.goarch }}.zip dist/ @@ -146,6 +148,13 @@ jobs: name: ${{ env.PKG_NAME }}_${{ needs.get-product-version.outputs.product-version }}_${{ matrix.goos }}_${{ matrix.goarch }}.zip path: out/${{ env.PKG_NAME }}_${{ needs.get-product-version.outputs.product-version }}_${{ matrix.goos }}_${{ matrix.goarch }}.zip + - name: Copy license file + env: + LICENSE_DIR: ".release/linux/package/usr/share/doc/${{ env.PKG_NAME }}" + run: | + mkdir -p "$LICENSE_DIR" + cp LICENSE "$LICENSE_DIR/LICENSE.txt" + - name: Package if: ${{ matrix.goos == 'linux' }} uses: hashicorp/actions-packaging-linux@v1 @@ -160,6 +169,7 @@ jobs: binary: "dist/${{ env.PKG_NAME }}" deb_depends: "openssl" rpm_depends: "openssl" + config_dir: ".release/linux/package/" - name: Set Package Names if: ${{ matrix.goos == 'linux' }} @@ -207,6 +217,7 @@ jobs: - name: Build run: | mkdir dist out + cp LICENSE dist/LICENSE.txt go build -tags netcgo -o dist/ zip -r -j out/${{ env.PKG_NAME }}_${{ needs.get-product-version.outputs.product-version }}_${{ matrix.goos }}_${{ matrix.goarch }}.zip dist/ diff --git a/Dockerfile b/Dockerfile index ae45908..5499340 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,11 +13,12 @@ ARG BIN_NAME=consul-esm ENV BIN_NAME=$BIN_NAME ARG PRODUCT_VERSION ARG PRODUCT_REVISION -ARG PRODUCT_NAME=$BIN_NAME +ENV PRODUCT_NAME=$BIN_NAME # TARGETARCH and TARGETOS are set automatically when --platform is provided. ARG TARGETOS TARGETARCH -LABEL maintainer="John Eikenberry " +LABEL maintainer="John Eikenberry " \ + org.opencontainers.image.licenses="MPL-2.0" # version label is required for build process LABEL version=$PRODUCT_VERSION LABEL revision=$PRODUCT_REVISION @@ -29,6 +30,7 @@ ARG GID=1000 RUN addgroup -g ${GID} ${BIN_NAME} \ && adduser -u ${UID} -S -G ${BIN_NAME} ${BIN_NAME} +COPY LICENSE /usr/share/doc/$PRODUCT_NAME/LICENSE.txt # where the build system stores the builds COPY ./dist/$TARGETOS/$TARGETARCH/$BIN_NAME /bin/