Skip to content

Commit

Permalink
parameterize jdk and nginx base images
Browse files Browse the repository at this point in the history
currently on m1 macs, switching between building for arm vs amd64
architectures is a bit cumbersome because some of the base docker images
have been parameterized yet, so you will run into build errors unless
you untag those base images every time you switch between architectures.

This PR should allow you switch freely without needing that manual step.
  • Loading branch information
git-phu committed Mar 18, 2022
1 parent f77b592 commit 51bc946
Show file tree
Hide file tree
Showing 11 changed files with 33 additions and 10 deletions.
4 changes: 3 additions & 1 deletion airbyte-bootloader/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
ARG JDK_VERSION=17.0.1
FROM openjdk:${JDK_VERSION}-slim
ARG JDK_IMAGE_REPOSITORY=openjdk
ARG JDK_IMAGE_TAG=${JDK_VERSION}-slim
FROM ${JDK_IMAGE_REPOSITORY}:${JDK_IMAGE_TAG}

ENV APPLICATION airbyte-bootloader

Expand Down
4 changes: 3 additions & 1 deletion airbyte-container-orchestrator/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
ARG JDK_VERSION=17.0.1
FROM openjdk:${JDK_VERSION}-slim AS sync-attempt
ARG JDK_IMAGE_REPOSITORY=openjdk
ARG JDK_IMAGE_TAG=${JDK_VERSION}-slim
FROM ${JDK_IMAGE_REPOSITORY}:${JDK_IMAGE_TAG} AS sync-attempt

ARG DOCKER_BUILD_ARCH=amd64

Expand Down
4 changes: 3 additions & 1 deletion airbyte-integrations/bases/base-java/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
ARG JDK_VERSION=17.0.1
FROM openjdk:${JDK_VERSION}-slim
ARG JDK_IMAGE_REPOSITORY=openjdk
ARG JDK_IMAGE_TAG=${JDK_VERSION}-slim
FROM ${JDK_IMAGE_REPOSITORY}:${JDK_IMAGE_TAG}
COPY --from=airbyte/integration-base:dev /airbyte /airbyte

WORKDIR /airbyte
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
ARG JDK_VERSION=17.0.1
FROM openjdk:${JDK_VERSION}-slim
ARG JDK_IMAGE_REPOSITORY=openjdk
ARG JDK_IMAGE_TAG=${JDK_VERSION}-slim
FROM ${JDK_IMAGE_REPOSITORY}:${JDK_IMAGE_TAG}

ARG DOCKER_BUILD_ARCH=amd64

Expand Down
4 changes: 3 additions & 1 deletion airbyte-integrations/bases/standard-source-test/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
ARG JDK_VERSION=17.0.1
FROM openjdk:${JDK_VERSION}-slim
ARG JDK_IMAGE_REPOSITORY=openjdk
ARG JDK_IMAGE_TAG=${JDK_VERSION}-slim
FROM ${JDK_IMAGE_REPOSITORY}:${JDK_IMAGE_TAG}

ARG DOCKER_BUILD_ARCH=amd64

Expand Down
4 changes: 3 additions & 1 deletion airbyte-metrics/reporter/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
ARG JDK_VERSION=17.0.1
FROM openjdk:${JDK_VERSION}-slim AS metrics-reporter
ARG JDK_IMAGE_REPOSITORY=openjdk
ARG JDK_IMAGE_TAG=${JDK_VERSION}-slim
FROM ${JDK_IMAGE_REPOSITORY}:${JDK_IMAGE_TAG} AS metrics-reporter

ENV APPLICATION airbyte-metrics-reporter

Expand Down
4 changes: 3 additions & 1 deletion airbyte-scheduler/app/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
ARG JDK_VERSION=17.0.1
FROM openjdk:${JDK_VERSION}-slim AS scheduler
ARG JDK_IMAGE_REPOSITORY=openjdk
ARG JDK_IMAGE_TAG=${JDK_VERSION}-slim
FROM ${JDK_IMAGE_REPOSITORY}:${JDK_IMAGE_TAG} AS scheduler

ENV APPLICATION airbyte-scheduler

Expand Down
4 changes: 3 additions & 1 deletion airbyte-server/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
ARG JDK_VERSION=17.0.1
FROM openjdk:${JDK_VERSION}-slim AS server
ARG JDK_IMAGE_REPOSITORY=openjdk
ARG JDK_IMAGE_TAG=${JDK_VERSION}-slim
FROM ${JDK_IMAGE_REPOSITORY}:${JDK_IMAGE_TAG} AS server

EXPOSE 8000

Expand Down
3 changes: 2 additions & 1 deletion airbyte-webapp/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM nginx:1.19-alpine as webapp
ARG NGINX_IMAGE=nginx:1.19-alpine
FROM ${NGINX_IMAGE} as webapp

EXPOSE 80

Expand Down
4 changes: 3 additions & 1 deletion airbyte-workers/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
ARG JDK_VERSION=17.0.1
FROM openjdk:${JDK_VERSION}-slim AS worker
ARG JDK_IMAGE_REPOSITORY=openjdk
ARG JDK_IMAGE_TAG=${JDK_VERSION}-slim
FROM ${JDK_IMAGE_REPOSITORY}:${JDK_IMAGE_TAG} AS worker

ARG DOCKER_BUILD_ARCH=amd64

Expand Down
4 changes: 4 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ def Task getDockerBuildTask(String artifactName, String projectDir) {
def buildPlatform = System.getenv('DOCKER_BUILD_PLATFORM') ?: 'linux/amd64'
def alpineImage = System.getenv('ALPINE_IMAGE') ?: 'alpine:3.4'
def postgresImage = System.getenv('POSTGRES_IMAGE') ?: 'postgres:13-alpine'
def nginxImage = System.getenv('NGINX_IMAGE') ?: 'nginx:1.19-alpine'
def openJDKImageRepo = System.getenv('JDK_IMAGE_REPOSITORY') ?: 'openjdk'
def jdkVersion = System.getenv('JDK_VERSION') ?: '17.0.1'
def buildArch = System.getenv('DOCKER_BUILD_ARCH') ?: 'amd64'

Expand All @@ -145,6 +147,8 @@ def Task getDockerBuildTask(String artifactName, String projectDir) {
buildArgs.put('DOCKER_BUILD_ARCH', buildArch)
buildArgs.put('ALPINE_IMAGE', alpineImage)
buildArgs.put('POSTGRES_IMAGE', postgresImage)
buildArgs.put('NGINX_IMAGE', nginxImage)
buildArgs.put('JDK_IMAGE_REPOSITORY', openJDKImageRepo)
})
}

Expand Down

0 comments on commit 51bc946

Please sign in to comment.