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

Added Dockerfile stage for JAR assembly #5

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*
!project/build.properties
!project/build.sbt
!src/main/*
!build.sbt
2 changes: 1 addition & 1 deletion .github/workflows/release_docker_jar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
name: sync_job.jar
path: lib/
- name: Build image
run: docker build . -f docker/Dockerfile -t syncjob
run: DOCKER_BUILDKIT=1 docker build . -f docker/Dockerfile -t syncjob --target package-ci
- name: Log into registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin
- name: Push image
Expand Down
23 changes: 21 additions & 2 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
FROM flink:1.11.2-scala_2.12
#########################
# Stage 1: sbt assembly #
#########################

ADD lib/sync_job.jar /opt/flink/usrlib/
FROM mozilla/sbt:8u232_1.4.9 AS assembly
WORKDIR /home
COPY . .
RUN sbt assembly

#######################
# Stage 2a: packaging #
#######################

FROM flink:1.11.2-scala_2.12 AS package
COPY --from=assembly /home/lib/sync_job.jar /opt/flink/usrlib/

###################################################
# Stage 2b: packaging in CI (jar already present) #
###################################################

FROM flink:1.11.2-scala_2.12 AS package-ci
ADD lib/sync_job.jar /opt/flink/usrlib/