Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add license file to linux distribution and docker image #365

Merged
merged 1 commit into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,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/

Expand Down Expand Up @@ -142,6 +143,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/

Expand All @@ -150,6 +152,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
Expand All @@ -164,6 +173,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
5 changes: 4 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,15 @@ ARG BIN_NAME=envconsul
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 <[email protected]>"
# version label is required for build process
LABEL version=$PRODUCT_VERSION
LABEL revision=$PRODUCT_REVISION
LABEL licenses="MPL-2.0"

# These are the defaults, this makes them explicit and overridable.
ARG UID=100
Expand All @@ -31,6 +32,8 @@ RUN addgroup -g ${GID} ${BIN_NAME} \

# where the build system stores the builds
COPY ./dist/$TARGETOS/$TARGETARCH/$BIN_NAME /bin/
# copy the license file to the required directory
COPY LICENSE /usr/share/doc/$PRODUCT_NAME/LICENSE.txt

# entrypoint
COPY ./.release/docker-entrypoint.sh /bin/
Expand Down
Loading