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

Use bazel-base image as basis for Bazel builds in Dockerfiles #14903

Open
LKreutzer opened this issue Jan 27, 2023 · 1 comment
Open

Use bazel-base image as basis for Bazel builds in Dockerfiles #14903

LKreutzer opened this issue Jan 27, 2023 · 1 comment
Labels
bazel changes for the Bazelification effort component: ci All updates on CI (Jenkins/CircleCi/Github Action) containerization Changes for more docker usage

Comments

@LKreutzer
Copy link
Contributor

LKreutzer commented Jan 27, 2023

Use bazel-base image as basis for Bazel builds in Dockerfiles

E.g. in lte/gateway/docker/services/c/Dockerfile a new Docker image is built from Focal, in which a Bazel build happens. Having many different Docker files is hard to maintain. If all Bazel builds are based on the bazel-base Docker image then the same conditions and system dependencies are used for all builds. It may also speed up the workflows.

I.e. in lte/gateway/docker/services/c/Dockerfile, instead of doing

FROM $OS_DIST:$OS_RELEASE AS builder
...
...
  # Setup necessary tools for adding the Magma repository
  apt-get install -y apt-utils software-properties-common apt-transport-https gnupg wget && \
  # Download Bazel
  wget -P /usr/sbin --progress=dot:giga https://github.com/bazelbuild/bazelisk/releases/download/v1.10.0/bazelisk-linux-"${DEB_PORT}" && \
  chmod +x /usr/sbin/bazelisk-linux-"${DEB_PORT}" && \
  ln -s /usr/sbin/bazelisk-linux-"${DEB_PORT}" /usr/sbin/bazel

# Install dependencies required for building
...

simply do

FROM ghcr.io/magma/magma/bazel-base:latest AS builder
...
bazel build ...
@LKreutzer LKreutzer added component: ci All updates on CI (Jenkins/CircleCi/Github Action) containerization Changes for more docker usage labels Jan 27, 2023
@LKreutzer LKreutzer changed the title Use bazel-base container as basis for Bazel builds in Dockerfiles Use bazel-base image as basis for Bazel builds in Dockerfiles Jan 27, 2023
@LKreutzer LKreutzer added the bazel changes for the Bazelification effort label Jan 27, 2023
@LKreutzer
Copy link
Contributor Author

⚠ It needs to be ensured that the build is also possible on ARM, which is difficult with the current bazel-base image.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bazel changes for the Bazelification effort component: ci All updates on CI (Jenkins/CircleCi/Github Action) containerization Changes for more docker usage
Projects
None yet
Development

No branches or pull requests

1 participant