Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
stanislavb committed Dec 3, 2024
0 parents commit 1f676f2
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Docker Image CI

on: # yamllint disable-line rule:truthy
push:
tags:
- '*'

jobs:
build-and-publish:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Extract tag name
id: tag_name
run: echo "TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- name: Build and push java image
run: |
docker build -t tomologic/java:${{ env.TAG }} .
docker push tomologic/java:${{ env.TAG }}
- name: Build and push maven image
run: |
cd maven
docker build \
--build-arg BASE_IMAGE=tomologic/java:${{ env.TAG }} \
-t tomologic/java:${{ env.TAG }}-maven .
docker push tomologic/java:${{ env.TAG }}-maven
18 changes: 18 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM debian:bullseye

# https://bell-sw.com/pages/downloads/?version=java
# Full version includes JFX
ENV JDK_VERSION=8u432+7
ENV JDK_URL=https://download.bell-sw.com/java/${JDK_VERSION}/bellsoft-jdk${JDK_VERSION}-linux-amd64-full.deb
ENV JDK_SHA1=868a47262f2f99c27e846fbe75a7fae17c0104bb

SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN apt-get update \
&& apt-get install --no-install-recommends -y ca-certificates curl \
&& curl -fsSL ${JDK_URL} -o /opt/java.deb \
&& echo "${JDK_SHA1} /opt/java.deb" | sha1sum -c - \
&& apt -y install /opt/java.deb \
&& rm /opt/java.deb \
&& java -version \
&& apt-get remove -y ca-certificates curl \
&& rm -rf /var/lib/apt/lists/*
16 changes: 16 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash
set -e

VERSION="$(git rev-parse --short HEAD)"
docker build --platform=linux/amd64 --progress=plain -t "tomologic/java:$VERSION" .
for dir in ./*/; do
if [[ -f "${dir}Dockerfile" ]]; then
dirname=$(basename "$dir")
echo "Processing directory: $dirname"
cd "$dirname"
docker build --platform=linux/amd64 --progress=plain -t "tomologic/java:$VERSION-$dirname" \
--build-arg BASE_IMAGE="tomologic/java:$VERSION" .
cd ..
fi
done

19 changes: 19 additions & 0 deletions maven/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
ARG BASE_IMAGE
FROM ${BASE_IMAGE}

# https://maven.apache.org/download.cgi
ENV MAVEN_VERSION=3.9.9
ENV MAVEN_URL=https://dlcdn.apache.org/maven/maven-3/${MAVEN_VERSION}/binaries/apache-maven-${MAVEN_VERSION}-bin.tar.gz
ENV MAVEN_SHA512=a555254d6b53d267965a3404ecb14e53c3827c09c3b94b5678835887ab404556bfaf78dcfe03ba76fa2508649dca8531c74bca4d5846513522404d48e8c4ac8b

ENV PATH=/usr/local/apache-maven-${MAVEN_VERSION}/bin:$PATH
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
# Extra tools kept besides maven: curl, unzip
RUN apt-get update \
&& apt-get install --no-install-recommends -y ca-certificates curl unzip\
&& curl -fsSL ${MAVEN_URL} -o /opt/maven.tar.gz \
&& echo "${MAVEN_SHA512} /opt/maven.tar.gz" | sha512sum -c - \
&& tar xzvf /opt/maven.tar.gz -C /usr/local \
&& rm /opt/maven.tar.gz \
&& mvn -version \
&& rm -rf /var/lib/apt/lists/*

0 comments on commit 1f676f2

Please sign in to comment.