-
Notifications
You must be signed in to change notification settings - Fork 35
Add installation and packaging targets #19
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
base: main
Are you sure you want to change the base?
Conversation
…mated Docker packaging
uekerman
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was not able to run your code. Parts of your solution seem generated, are they?
| # Option for bonus task: allow building the library as shared | ||
| option(CPACKEXAMPLE_BUILD_SHARED "Build cpackexamplelib as a shared library" OFF) | ||
|
|
||
| if (CPACKEXAMPLE_BUILD_SHARED) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How is the variable different to BUILD_SHARED_LIBS?
| set(CPACK_PACKAGE_VERSION_MAJOR 0) | ||
| set(CPACK_PACKAGE_VERSION_MINOR 1) | ||
| set(CPACK_PACKAGE_VERSION_PATCH 0) | ||
| set(CPACK_PACKAGE_VERSION | ||
| "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}" | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better take the versions from the project, don't hard-code here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, Sure. Will take care of it next time.
| ENV PATH=$PATH:/usr/local/bin/ | ||
|
|
||
| # Script to configure, build (shared), and create packages automatically | ||
| RUN cat > /usr/local/bin/build-and-package.sh << 'EOF' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| RUN cat > /usr/local/bin/build-and-package.sh << 'EOF' | |
| RUN <<'EOF' | |
| cat > /usr/local/bin/build-and-package.sh |
Did your code work for you?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It did, as per my knowledge. What is the issue @uekerman ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
docker build -t cpack-exercise .
[+] Building 0.1s (2/2) FINISHED docker:default
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 2.15kB 0.0s
Dockerfile:37
--------------------
35 | RUN cat > /usr/local/bin/build-and-package.sh << 'EOF'
36 | #!/bin/bash
37 | >>> set -euo pipefail
38 |
39 | SRC_DIR=/mnt/cpack-exercise
--------------------
ERROR: failed to solve: dockerfile parse error on line 37: unknown instruction: set (did you mean user?)
I am using:
docker --version
Docker version 24.0.6, build ed223bc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @uekerman,
I tried to reproduce the Docker build error (unknown instruction: set) on my side but was not able to get it.
On my machine, I am using Docker Desktop 28.5.1. I tested the Dockerfile both with BuildKit enabled and disabled (using DOCKER_BUILDKIT=0), and in both cases it builds successfully, including the RUN cat > … << 'EOF' block with indented content.
I believe the build failure you're experiencing is due to a Docker version difference. You mentioned using Docker 24.0.6, which appears to have stricter parsing rules for heredoc syntax in Dockerfiles. In older Docker versions, the heredoc content (the lines between << 'EOF' and EOF) must start at the beginning of the line with no leading whitespace. When indentation is present, the legacy parser interprets those indented lines as Dockerfile instructions rather than heredoc content, which causes the error: unknown instruction: set.
Newer Docker versions (25.0+) introduced support for indented heredoc content, making the syntax more flexible and readable. Docker Desktop 28.5.1 supports this feature regardless of whether BuildKit is explicitly enabled or disabled.
Gitlab Username : nikhilnl
This commit completes the mandatory CPack assignment and optional bonus tasks.
Mandatory features:
Lintian:
How to build and test:
Start container interactively:
Inside the container:
Bonus work:
Automated packaging command:
After container exits on the host:
Expected output:
This commit completes all required tasks and implements the full optional automation workflow.