From d31d0644de4f7d412d97bcc85bd3d0295f572668 Mon Sep 17 00:00:00 2001 From: Gert Goet Date: Fri, 1 Mar 2024 10:57:34 +0100 Subject: [PATCH] Build docker image --- .github/workflows/release.yml | 37 ++++++++++++++++++++++++++++++++++- docker/Dockerfile | 29 +++++++++++++++++++++++++++ 2 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 docker/Dockerfile diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ce2fb2a..57b7df8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -10,7 +10,7 @@ on: push: branches: - master - - build-jar + - feature/dockerfile jobs: Config: @@ -120,3 +120,38 @@ jobs: deps-try-bb.jar deps-try.zip resources/VERSION + Dockerize: + needs: [Config, Build] + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - name: Check out repository code + uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Install clojure tools + uses: DeLaGuardo/setup-clojure@9.4 + with: + bb: latest + #- name: Update VERSION + # run: echo "${{ needs.Config.outputs.version }}" > resources/VERSION + - name: Log in to the Container registry + uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + - name: Build and push Docker image + uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4 + with: + context: docker + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..95bd274 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,29 @@ +FROM clojure:temurin-21-tools-deps-bullseye-slim + +RUN apt-get -yqq update && \ + apt-get -yqq upgrade && \ + apt-get -yqq install sudo && \ + apt-get -yqq install git curl && \ + rm -rf /var/lib/apt/lists/* + +RUN curl -sLO https://raw.githubusercontent.com/babashka/babashka/master/install && \ + chmod +x install && \ + ./install && \ + rm ./install + + +# Image will default non-root user: deps-try-user +RUN groupadd deps-try-user && \ + useradd --create-home --shell /bin/bash --gid deps-try-user deps-try-user && \ + usermod -a -G sudo deps-try-user && \ + echo 'ALL ALL = (ALL) NOPASSWD: ALL' >> /etc/sudoers && \ + echo 'deps-try-user:secret' | chpasswd +ENV HOME=/home/deps-try-user + +USER deps-try-user +WORKDIR /home/deps-try-user + +RUN curl -sLO https://github.com/eval/deps-try/releases/download/unstable/deps-try-bb.jar && \ + bb deps-try-bb.jar -P + +ENTRYPOINT ["/usr/local/bin/bb", "deps-try-bb.jar"] \ No newline at end of file