From cf46c8ef461bb943d75b50064ac5888449c560ed Mon Sep 17 00:00:00 2001 From: Xinyi Wang Date: Tue, 28 May 2024 12:31:32 -0700 Subject: [PATCH] add license file --- .github/workflows/build.yml | 10 ++++++++++ Dockerfile | 3 +++ 2 files changed, 13 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8a6703b26..b5b93a3b5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -98,6 +98,7 @@ jobs: LD_FLAGS: ${{ needs.set-ld-flags.outputs.ldflags }} run: | mkdir dist out + cp LICENSE dist/LICENSE.txt go build -o dist/ \ -ldflags "${{ env.LD_FLAGS }}" \ -tags "${{ env.GO_TAGS }}" @@ -107,6 +108,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 @@ -121,6 +129,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' }} @@ -169,6 +178,7 @@ jobs: GO_TAGS: "${{ env.GO_TAGS }} netcgo" run: | mkdir dist out + cp LICENSE dist/LICENSE.txt go build -o dist/ \ -ldflags "${{ env.LD_FLAGS }}" \ -tags "${{ env.GO_TAGS }}" diff --git a/Dockerfile b/Dockerfile index b5b85a9ad..4c733423e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,10 +10,12 @@ ARG PRODUCT_VERSION LABEL maintainer="Consul Team " LABEL version=$PRODUCT_VERSION +LABEL licenses="MPL-2.0" # Set ARGs as ENV so that they can be used in ENTRYPOINT/CMD ENV NAME=$NAME ENV VERSION=$PRODUCT_VERSION +ENV PRODUCT_NAME=$NAME # TARGETARCH and TARGETOS are set automatically when --platform is provided. ARG TARGETOS TARGETARCH @@ -24,6 +26,7 @@ RUN apk add --no-cache dumb-init git bash openssh RUN addgroup ${NAME} && adduser -S -G ${NAME} ${NAME} COPY dist/$TARGETOS/$TARGETARCH/consul-terraform-sync /bin/consul-terraform-sync +COPY LICENSE /usr/share/doc/$PRODUCT_NAME/LICENSE.txt ### Added for CTS RUN mkdir -p /consul-terraform-sync/config \