Skip to content

Commit

Permalink
Build docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
eval committed Mar 1, 2024
1 parent a91f417 commit d31d064
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 1 deletion.
37 changes: 36 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
push:
branches:
- master
- build-jar
- feature/dockerfile

jobs:
Config:
Expand Down Expand Up @@ -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 }}
29 changes: 29 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]

0 comments on commit d31d064

Please sign in to comment.