-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: ci | ||
|
||
on: | ||
push: | ||
branches: | ||
- 'main' | ||
|
||
jobs: | ||
docker: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- | ||
name: Login to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
- name: Build and push | ||
uses: docker/build-push-action@v5 | ||
with: | ||
push: true | ||
tags: mvukov/bazel-builder:commit-${{ github.sha }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
FROM ubuntu:22.04 | ||
|
||
ARG DEBIAN_FRONTEND=noninteractive | ||
|
||
ARG BAZELISK_VER=1.17.0 | ||
ARG GCC_VER=11 | ||
ARG CLANG_VER=14 | ||
|
||
RUN apt update && apt-get install -y \ | ||
clang-$CLANG_VER \ | ||
curl \ | ||
gcc-$GCC_VER \ | ||
g++-$GCC_VER \ | ||
libatomic1 \ | ||
python3 | ||
|
||
RUN update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-$CLANG_VER 100 \ | ||
&& update-alternatives --install /usr/bin/clang clang /usr/bin/clang-$CLANG_VER 100 \ | ||
&& update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-$GCC_VER 100 \ | ||
&& update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-$GCC_VER 100 | ||
|
||
RUN curl -L "https://github.com/bazelbuild/bazelisk/releases/download/v${BAZELISK_VER}/bazelisk-linux-amd64" -o /usr/local/bin/bazelisk \ | ||
&& chmod +x /usr/local/bin/bazelisk \ | ||
&& ln -s /usr/local/bin/bazelisk /usr/local/bin/bazel | ||
|
||
# Based on https://code.visualstudio.com/remote/advancedcontainers/add-nonroot-user#_creating-a-nonroot-user | ||
ARG USERNAME=ci | ||
ARG USER_UID=1000 | ||
ARG USER_GID=$USER_UID | ||
RUN groupadd --gid $USER_GID $USERNAME \ | ||
&& useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \ | ||
&& apt-get install -y sudo \ | ||
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \ | ||
&& chmod 0440 /etc/sudoers.d/$USERNAME | ||
|
||
USER $USERNAME |