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

Release docker image to github container registry #55

Merged
merged 2 commits into from
Nov 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
Dockerfile
**/target/

.idea/
.idea/
.github/
.run/
47 changes: 0 additions & 47 deletions .github/workflows/release-ghcr-latest.yml

This file was deleted.

29 changes: 29 additions & 0 deletions .github/workflows/release-latest-ghcr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: CI to Github Container Registry

on:
push:
branches: [ master ]

jobs:
build:
name: Main
if: github.repository_owner == 'memiiso'
runs-on: ubuntu-latest
steps:
- name: Check Out Repo
uses: actions/checkout@v2

- name: Login to Github Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- uses: docker/build-push-action@v2
name: Build & push Docker image
with:
context: ./
file: ./Dockerfile
push: true
tags: ghcr.io/${{ github.repository_owner }}/debezium-server-iceberg:latest
19 changes: 10 additions & 9 deletions .github/workflows/release-latest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,26 @@ env:
jobs:
build:
name: Main
if: github.repository_owner == 'memiiso'
runs-on: ubuntu-latest
steps:
- name: Checkout
- name: Check Out Repo
uses: actions/checkout@v2

- name: Set env
run: |
echo "RELEASE_NAME=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
echo "RELEASE_NAME=latest" >> $GITHUB_ENV
echo "RELEASE_BRANCH=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
echo "RELEASE_TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- name: Build project
run: mvn -B package -Passembly --file pom.xml -Drevision=latest
run: mvn -B package -Passembly --file pom.xml -Drevision=${{ env.RELEASE_NAME }}

- name: Delete latest release
- name: Delete ${{ env.RELEASE_NAME }} release
uses: dev-drprasad/[email protected]
with:
delete_release: true # default: false
tag_name: latest
tag_name: ${{ env.RELEASE_NAME }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expand All @@ -38,9 +39,9 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
name: Release master/latest
tag_name: latest
body: master branch release
name: Release ${{ env.RELEASE_NAME }}
tag_name: ${{ env.RELEASE_NAME }}
body: Release master branch
draft: false
prerelease: true
files: debezium-server-dist/target/debezium-server-dist-latest.zip
files: debezium-server-dist/target/debezium-server-dist-${{ env.RELEASE_NAME }}.zip
3 changes: 2 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ env:
jobs:
build:
name: Main
if: github.repository_owner == 'memiiso'
runs-on: ubuntu-latest
steps:
- name: Checkout
- name: Check Out Repo
uses: actions/checkout@v2

- name: Set env
Expand Down
37 changes: 9 additions & 28 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,34 +1,15 @@
FROM eclipse-temurin:11-jdk as builder

# Downloading and installing Maven
ARG MAVEN_VERSION=3.8.3
ARG USER_HOME_DIR="/root"
ARG SHA=1c12a5df43421795054874fd54bb8b37d242949133b5bf6052a063a13a93f13a20e6e9dae2b3d85b9c7034ec977bbc2b6e7f66832182b9c863711d78bfe60faa
ARG BASE_URL=https://dlcdn.apache.org/maven/maven-3/${MAVEN_VERSION}/binaries

RUN mkdir -p /usr/share/maven /usr/share/maven/ref \
&& echo "Downlaoding maven" \
&& curl -fsSL -o /tmp/apache-maven.tar.gz ${BASE_URL}/apache-maven-${MAVEN_VERSION}-bin.tar.gz \
\
&& echo "Checking download hash" \
&& echo "${SHA} /tmp/apache-maven.tar.gz" | sha512sum -c - \
\
&& echo "Unziping maven" \
&& tar -xzf /tmp/apache-maven.tar.gz -C /usr/share/maven --strip-components=1 \
\
&& echo "Cleaning and setting links" \
&& rm -f /tmp/apache-maven.tar.gz \
&& ln -s /usr/share/maven/bin/mvn /usr/bin/mvn

ENV MAVEN_HOME /usr/share/maven
ENV MAVEN_CONFIG "$USER_HOME_DIR/.m2"

RUN apt-get -qq update && apt-get -qq install maven unzip
COPY . /app
WORKDIR /app
RUN mvn clean package -Passembly -Dmaven.test.skip
RUN mvn clean package -Passembly -Dmaven.test.skip --quiet
RUN unzip /app/debezium-server-dist/target/debezium-server-dist*.zip -d appdist

FROM eclipse-temurin:11-jre
COPY --from=builder /app/appdist/ /app/

WORKDIR /app
EXPOSE 8080 8083
VOLUME ["/app/conf", "/app/data"]

COPY --from=builder /app/debezium-server-dist/target /app/target
RUN cp /app/target/debezium-server-dist-*-runner.jar /app/target/debezium-server-dist-runner.jar
ENTRYPOINT ["java", "-cp", "/app/target/debezium-server-dist-runner.jar:/opt/conf:/app/target/lib/*", "io.debezium.server.Main"]
ENTRYPOINT ["/app/run.sh"]
2 changes: 1 addition & 1 deletion debezium-server-dist/src/main/resources/distro/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ fi

RUNNER=$(ls debezium-server-*runner.jar)

exec $JAVA_BINARY $DEBEZIUM_OPTS $JAVA_OPTS -cp "$RUNNER"$PATH_SEP"conf"$PATH_SEP"lib/*" io.debezium.server.Main
exec $JAVA_BINARY $DEBEZIUM_OPTS $JAVA_OPTS -cp "$RUNNER"$PATH_SEP"conf"$PATH_SEP"lib/*"$PATH_SEP"/opt/conf" io.debezium.server.Main