-
Notifications
You must be signed in to change notification settings - Fork 1
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
adding docker developer build with bazel #2
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
FROM ubuntu:22.04 | ||
# docker build -t old . | ||
RUN apt-get update && apt-get install -y curl gnupg | ||
RUN curl https://bazel.build/bazel-release.pub.gpg | apt-key add - && \ | ||
echo "deb [arch=amd64] https://storage.googleapis.com/bazel-apt stable jdk1.8" | tee /etc/apt/sources.list.d/bazel.list | ||
RUN apt-get update && apt-get install -y bazel | ||
WORKDIR /code | ||
COPY . /code | ||
RUN bazel build src/main:libold.so |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
# old | ||
|
||
![main brabcg](https://github.com/fzakaria/old/actions/workflows/actions.yml/badge.svg) | ||
![main branch](https://github.com/fzakaria/old/actions/workflows/actions.yml/badge.svg) | ||
|
||
> The Other Dynamic Linker | ||
|
||
|
@@ -120,6 +120,7 @@ The tool generously provides the required TOML file necessary for the configurat | |
This repository uses [bazel](https://docs.bazel.build/) as the build system; some familiarity is required. | ||
|
||
Once you have bazel installed, building the shared object is done as follows. | ||
|
||
```console | ||
$ bazel build src/main:libold.so | ||
``` | ||
|
@@ -128,4 +129,34 @@ You can then run the built binary with the example TOML file provided by setting | |
|
||
```console | ||
$ OLDAUDIT_CONFIG=./example.toml LD_AUDIT=./bazel-bin/src/main/libold.so ruby --help | head | ||
``` | ||
``` | ||
|
||
### Docker | ||
|
||
If you want to develop using a Docker container, we provide a [Dockerfile](Dockerfile) | ||
with bazel ready to go! First, build the container: | ||
|
||
```bash | ||
$ docker build -t old . | ||
``` | ||
|
||
You can then shell inside to use old: | ||
|
||
```bash | ||
$ docker run -it old | ||
``` | ||
```bash | ||
$ apt-get install -y ruby | ||
$ LD_AUDIT=./bazel-bin/src/main/libold.so ruby -e "puts 'hi'" | ||
$ OLDAUDIT_CONFIG=./example.toml LD_AUDIT=./bazel-bin/src/main/libold.so ruby --help | head | ||
``` | ||
|
||
or bind the present working directory (with the source code) to `/code` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should this be bazel-code? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No indeed not - the code is bound to |
||
to work locally and build in the container: | ||
|
||
```bash | ||
$ docker run -it -v $PWD:/code old | ||
$ bazel build src/main:libold.so | ||
``` | ||
|
||
Have fun! |
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.
what's this?
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.
This is one of the linked executables that appeared during the build from bazel - it's on my host because I tested binding the PWD to /code (and it generated). Here is the (now dead) symlink in root's home (in the container):
here are the whole set:
Was this possibly added in a newer release? If you build the container and bind to /code and then build you should see the same pop up!