Skip to content

Commit

Permalink
copy the license file into artifacts (#479)
Browse files Browse the repository at this point in the history
  • Loading branch information
xwa153 committed Apr 29, 2024
1 parent a052657 commit 1e0c905
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 deletions.
16 changes: 14 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,16 @@ jobs:
os: ${{ matrix.goos }}
arch: ${{ matrix.goarch }}
reproducible: assert
instructions: CGO_ENABLED=0 go build -trimpath -buildvcs=false -ldflags="-X github.com/hashicorp/consul-dataplane/pkg/version.GitCommit=${GITHUB_SHA::8}" -o $BIN_PATH ./cmd/$BIN_NAME
instructions: |
cp LICENSE $TARGET_DIR/LICENSE.txt
CGO_ENABLED=0 go build -trimpath -buildvcs=false -ldflags="-X github.com/hashicorp/consul-dataplane/pkg/version.GitCommit=${GITHUB_SHA::8}" -o $BIN_PATH ./cmd/$BIN_NAME
- 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' }}
Expand All @@ -91,6 +100,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' }}
Expand Down Expand Up @@ -138,7 +148,9 @@ jobs:
os: ${{ matrix.goos }}
arch: ${{ matrix.goarch }}
reproducible: assert
instructions: CGO_ENABLED=0 go build -trimpath -buildvcs=false -ldflags="-X github.com/hashicorp/consul-dataplane/pkg/version.GitCommit=${GITHUB_SHA::8}" -o $BIN_PATH ./cmd/$BIN_NAME
instructions: |
cp LICENSE $TARGET_DIR/LICENSE.txt
CGO_ENABLED=0 go build -trimpath -buildvcs=false -ldflags="-X github.com/hashicorp/consul-dataplane/pkg/version.GitCommit=${GITHUB_SHA::8}" -o $BIN_PATH ./cmd/$BIN_NAME
build-docker-default:
name: Docker ${{ matrix.arch }} default release build
Expand Down
14 changes: 10 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ ARG BIN_NAME=consul-dataplane
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
Expand All @@ -54,7 +54,10 @@ LABEL name=${BIN_NAME}\
release=${PRODUCT_REVISION} \
revision=${PRODUCT_REVISION} \
summary="Consul dataplane manages the proxy that runs within the data plane layer of Consul Service Mesh." \
description="Consul dataplane manages the proxy that runs within the data plane layer of Consul Service Mesh."
description="Consul dataplane manages the proxy that runs within the data plane layer of Consul Service Mesh." \
org.opencontainers.image.licenses="MPL-2.0"

COPY LICENSE /usr/share/doc/$PRODUCT_NAME/LICENSE.txt

COPY --from=dumb-init /usr/bin/dumb-init /usr/local/bin/
COPY --from=go-discover /go/bin/discover /usr/local/bin/
Expand All @@ -76,7 +79,7 @@ ARG BIN_NAME=consul-dataplane
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

Expand All @@ -87,7 +90,10 @@ LABEL name=${BIN_NAME}\
release=${PRODUCT_REVISION} \
revision=${PRODUCT_REVISION} \
summary="Consul dataplane connects an application to a Consul service mesh." \
description="Consul dataplane connects an application to a Consul service mesh."
description="Consul dataplane connects an application to a Consul service mesh." \
org.opencontainers.image.licenses="MPL-2.0"

COPY LICENSE /usr/share/doc/$PRODUCT_NAME/LICENSE.txt

RUN microdnf install -y shadow-utils

Expand Down

0 comments on commit 1e0c905

Please sign in to comment.