Introduce the airbyte gradle docker plugin to build JVM connectors. Add logic to allow us to slowly migrate from one build set up to the other. The majority of the work is taking in the metadata.yaml file, and converting that to buildArgs to be injected into the airbyte gradle docker plugin. In particular, we extract the base image from the metadata file. We also add the connector name by referencing the module. This outputs a file buildArgs.properties into the build folder. This is done by the DockerGenerateConnectorBuildArgs task. The AirbyteDockerConventionPlugin then takes in the generated buildArgs.properties file and feeds it into the Platform Docker plugin. It also feeds in the top-level Dockerfile, so the Docker plugin can copy it into the build folder. I tried to migrate this to Kotlin, however the repo needs to be upgraded to the same Kotlin and KSP version as the gradle plugin repos for this to be worth while. Otherwise we end up writing kotlin plugins with reflection, which is worse than the current groovy plugins.
31 lines
856 B
Docker
31 lines
856 B
Docker
# syntax=docker/dockerfile:1
|
|
# check=skip=InvalidDefaultArgInFrom
|
|
|
|
# Java connector Dockerfile for Airbyte
|
|
|
|
# Build arguments
|
|
ARG BASE_IMAGE
|
|
|
|
# Base image - using Amazon Corretto (Amazon's distribution of OpenJDK)
|
|
FROM ${BASE_IMAGE}
|
|
ARG CONNECTOR_NAME
|
|
|
|
# Set permissions for downloaded files
|
|
RUN chmod +x /airbyte/base.sh /airbyte/javabase.sh && \
|
|
chown airbyte:airbyte /airbyte/base.sh /airbyte/javabase.sh /airbyte/dd-java-agent.jar
|
|
|
|
ENV AIRBYTE_ENTRYPOINT="/airbyte/base.sh"
|
|
ENV APPLICATION="${CONNECTOR_NAME}"
|
|
|
|
# Add the connector TAR file and extract it
|
|
COPY airbyte-app.tar /tmp/${CONNECTOR_NAME}.tar
|
|
RUN tar xf /tmp/${CONNECTOR_NAME}.tar --strip-components=1 -C /airbyte && \
|
|
rm -rf /tmp/${CONNECTOR_NAME}.tar && \
|
|
chown -R airbyte:airbyte /airbyte
|
|
|
|
# Set the non-root user
|
|
USER airbyte
|
|
|
|
# Set entrypoint
|
|
ENTRYPOINT ["/airbyte/base.sh"]
|