Skip to content

Commit

Permalink
Commit Hash in Docker Image (#115)
Browse files Browse the repository at this point in the history
  • Loading branch information
stanbrub authored Aug 20, 2024
1 parent ddcb1e5 commit 738a579
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 3 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/branch-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,19 @@ concurrency: release
jobs:
assemble-deephaven-core:
runs-on: ubuntu-24.04
outputs:
git-revision: ${{ steps.get-git-revision.outputs.GIT_REVISION }}
steps:
- name: Checkout deephaven-core
uses: actions/checkout@v4
with:
repository: deephaven/deephaven-core
ref: ${{ github.event.inputs.deephaven_core_ref }}

- name: Get GIT Revision
id: get-git-revision
run: echo "GIT_REVISION="$(git rev-parse HEAD) >> $GITHUB_OUTPUT

- name: Setup JDK 11
id: setup-java-11
uses: actions/setup-java@v4
Expand Down Expand Up @@ -106,6 +112,7 @@ jobs:
env:
DEEPHAVEN_SOURCES: custom
DEEPHAVEN_VERSION: ${{ steps.artifact_metadata.outputs.deephaven_version }}
GIT_REVISION: ${{ needs.assemble-deephaven-core.outputs.git-revision }}
DEEPHAVEN_CORE_WHEEL: ${{ steps.artifact_metadata.outputs.deephaven_core_wheel }}
MULTI_ARCH: true
RELEASE: true
Expand Down
9 changes: 8 additions & 1 deletion .github/workflows/edge-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,18 @@ jobs:
if: ${{ github.repository_owner == 'deephaven' || github.event_name != 'schedule' }}

runs-on: ubuntu-24.04
outputs:
git-revision: ${{ steps.get-git-revision.outputs.GIT_REVISION }}
steps:
- name: Checkout deephaven-core
uses: actions/checkout@v4
with:
repository: deephaven/deephaven-core

- name: Get GIT Revision
id: get-git-revision
run: echo "GIT_REVISION="$(git rev-parse HEAD) >> $GITHUB_OUTPUT

- name: Setup JDK 11
id: setup-java-11
uses: actions/setup-java@v4
Expand All @@ -33,7 +39,7 @@ jobs:

- name: Set JAVA_HOME
run: echo "JAVA_HOME=${{ steps.setup-java-11.outputs.path }}" >> $GITHUB_ENV

- name: Setup gradle properties
run: |
.github/scripts/gradle-properties.sh >> gradle.properties
Expand Down Expand Up @@ -105,6 +111,7 @@ jobs:
env:
DEEPHAVEN_SOURCES: custom
DEEPHAVEN_VERSION: ${{ steps.artifact_metadata.outputs.deephaven_version }}
GIT_REVISION: ${{ needs.assemble-deephaven-core.outputs.git-revision }}
DEEPHAVEN_CORE_WHEEL: ${{ steps.artifact_metadata.outputs.deephaven_core_wheel }}
MULTI_ARCH: true
RELEASE: ${{ github.event_name != 'pull_request' }}
Expand Down
16 changes: 15 additions & 1 deletion contexts/server-slim/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,28 @@ LABEL \

# -------------------------------------

FROM openjdk-bits as deephaven-bits
FROM openjdk-bits as deephaven-bits-released
ARG DEEPHAVEN_VERSION
COPY --link --from=deephaven /opt/deephaven /opt/deephaven
LABEL \
io.deephaven.server.version="${DEEPHAVEN_VERSION}"

# -------------------------------------

FROM openjdk-bits as deephaven-bits-custom
ARG DEEPHAVEN_VERSION
ARG GIT_REVISION
COPY --link --from=deephaven /opt/deephaven /opt/deephaven
LABEL \
io.deephaven.server.version="${DEEPHAVEN_VERSION}" \
org.opencontainers.image.revision="${GIT_REVISION}"

# -------------------------------------

FROM deephaven-bits-${DEEPHAVEN_SOURCES} as deephaven-bits

# -------------------------------------

FROM deephaven-bits as grpc-health-probe-bits
ARG GRPC_HEALTH_PROBE_VERSION
ADD --link --chmod=755 \
Expand Down
16 changes: 15 additions & 1 deletion contexts/server/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -144,14 +144,28 @@ LABEL \

# -------------------------------------

FROM openjdk-bits as deephaven-bits
FROM openjdk-bits as deephaven-bits-released
ARG DEEPHAVEN_VERSION
COPY --link --from=deephaven /opt/deephaven /opt/deephaven
LABEL \
io.deephaven.server.version="${DEEPHAVEN_VERSION}"

# -------------------------------------

FROM openjdk-bits as deephaven-bits-custom
ARG DEEPHAVEN_VERSION
ARG GIT_REVISION
COPY --link --from=deephaven /opt/deephaven /opt/deephaven
LABEL \
io.deephaven.server.version="${DEEPHAVEN_VERSION}" \
org.opencontainers.image.revision="${GIT_REVISION}"

# -------------------------------------

FROM deephaven-bits-${DEEPHAVEN_SOURCES} as deephaven-bits

# -------------------------------------

FROM deephaven-bits as grpc-health-probe-bits
ARG GRPC_HEALTH_PROBE_VERSION
ADD --link --chmod=755 \
Expand Down
5 changes: 5 additions & 0 deletions server-slim.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ variable "DEEPHAVEN_VERSION" {
default = "0.36.0"
}

variable "GIT_REVISION" {
default = ""
}

variable "OPENJDK_VERSION" {
default = "21"
}
Expand Down Expand Up @@ -73,6 +77,7 @@ target "server-slim" {
]
args = {
DEEPHAVEN_VERSION = DEEPHAVEN_VERSION
GIT_REVISION = GIT_REVISION
OPENJDK_VERSION = OPENJDK_VERSION
UBUNTU_VERSION = UBUNTU_VERSION
GRPC_HEALTH_PROBE_VERSION = GRPC_HEALTH_PROBE_VERSION
Expand Down
5 changes: 5 additions & 0 deletions server.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ variable "DEEPHAVEN_VERSION" {
default = "0.36.0"
}

variable "GIT_REVISION" {
default = ""
}

variable "DEEPHAVEN_CORE_WHEEL" {
default = ""
}
Expand Down Expand Up @@ -169,6 +173,7 @@ target "server-context" {
context = "contexts/server/"
args = {
DEEPHAVEN_VERSION = DEEPHAVEN_VERSION
GIT_REVISION = GIT_REVISION
DEEPHAVEN_CORE_WHEEL = DEEPHAVEN_CORE_WHEEL
OPENJDK_VERSION = OPENJDK_VERSION
PYTHON_VERSION = PYTHON_VERSION
Expand Down

0 comments on commit 738a579

Please sign in to comment.