-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Bmoric/remove docker compose for build #7500
Changes from all commits
0f06d95
e85f1a9
dbbb298
9b00dc5
0f049e7
8957cd7
e3dd246
8f83ea8
5ab190c
7d32b90
d693c5c
8084031
e63c0f2
1b6bc9b
3b9efe9
5b3f566
dee7b07
2976178
cb538db
fecb366
71e79da
24a7cf8
c9251d9
d12c485
07d67f6
b8bbbab
23ed511
3acd34e
d279ca2
b32056c
d53150c
0c47eb7
014a29a
cba2bce
fa899f9
43bb8b0
a52643f
b0ae593
8a3b1fc
317ae87
86b22b2
d64750a
d42857a
24fd33c
2bf9b18
0a378cc
1d3d22f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
plugins { | ||
id "airbyte-docker" | ||
} | ||
Task dockerBuildTask = getDockerBuildTask("cli", "$project.projectDir") | ||
dockerBuildTask.dependsOn(copyDocker) | ||
assemble.dependsOn(dockerBuildTask) |
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
FROM postgres:13-alpine | ||
|
||
COPY src/main/resources/init.sql /docker-entrypoint-initdb.d/000_init.sql | ||
COPY bin/init.sql /docker-entrypoint-initdb.d/000_init.sql |
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,16 @@ | ||
import com.bmuschko.gradle.docker.tasks.image.DockerBuildImage | ||
|
||
buildscript { | ||
repositories { | ||
maven { | ||
url "https://plugins.gradle.org/m2/" | ||
} | ||
} | ||
dependencies { | ||
classpath 'com.bmuschko:gradle-docker-plugin:7.1.0' | ||
} | ||
} | ||
|
||
plugins { | ||
id 'base' | ||
id 'pmd' | ||
|
@@ -112,27 +125,36 @@ spotless { | |
} | ||
check.dependsOn 'spotlessApply' | ||
|
||
@SuppressWarnings('GroovyAssignabilityCheck') | ||
def Task getDockerBuildTask(String artifactName, String projectDir) { | ||
return task ("buildDockerImage-$artifactName" (type: DockerBuildImage) { | ||
def buildTag = System.getenv('VERSION') ?: 'dev' | ||
def buildPlatform = System.getenv('DOCKER_BUILD_PLATFORM') ?: 'linux/amd64' | ||
def jdkVersion = System.getenv('JDK_VERSION') ?: '14.0.2' | ||
def buildArch = System.getenv('DOCKER_BUILD_ARCH') ?: 'amd64' | ||
|
||
inputDir = file("$projectDir/build/docker") | ||
platform = buildPlatform | ||
images.add("airbyte/$artifactName:$buildTag") | ||
buildArgs.put('JDK_VERSION', jdkVersion) | ||
buildArgs.put('DOCKER_BUILD_ARCH', buildArch) | ||
}) | ||
} | ||
|
||
allprojects { | ||
apply plugin: 'base' | ||
apply plugin: 'com.bmuschko.docker-remote-api' | ||
|
||
afterEvaluate { project -> | ||
def composeDeps = [ | ||
":airbyte-config:init", | ||
":airbyte-db:lib", | ||
":airbyte-migration", | ||
":airbyte-scheduler:app", | ||
":airbyte-workers", | ||
":airbyte-server", | ||
":airbyte-webapp", | ||
].toSet().asImmutable() | ||
|
||
if (project.getPath() in composeDeps) { | ||
composeBuild.dependsOn(project.getPath() + ':assemble') | ||
} | ||
task copyDocker(type: Copy) { | ||
delete "build/docker" | ||
|
||
from "${project.projectDir}/Dockerfile" | ||
into "build/docker/" | ||
} | ||
} | ||
|
||
allprojects { | ||
apply plugin: 'base' | ||
|
||
// by default gradle uses directory as the project name. That works very well in a single project environment but | ||
// projects clobber each other in an environments with subprojects when projects are in directories named identically. | ||
def sub = rootDir.relativePath(projectDir.parentFile).replace('/', '.') | ||
|
@@ -234,6 +256,7 @@ subprojects { | |
testImplementation 'org.junit.jupiter:junit-jupiter-params:5.7.2' | ||
testImplementation 'org.mockito:mockito-junit-jupiter:3.12.4' | ||
testImplementation 'org.assertj:assertj-core:3.21.0' | ||
|
||
} | ||
|
||
tasks.withType(Tar) { | ||
|
@@ -245,28 +268,6 @@ subprojects { | |
} | ||
} | ||
|
||
task composeBuild { | ||
def buildTag = System.getenv('VERSION') ?: 'dev' | ||
def buildPlatform = System.getenv('DOCKER_BUILD_PLATFORM') ?: 'linux/amd64' | ||
def buildArch = System.getenv('DOCKER_BUILD_ARCH') ?: 'amd64' | ||
def jdkVersion = System.getenv('JDK_VERSION') ?: '14.0.2' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should try not to remove the functionality we have here. Currently, someone following the instructions on https://docs.airbyte.io/contributing-to-airbyte/developing-locally#build-with-gradle to build for M1 won't be able to since these env vars aren't captured and don't make it to the docker build steps. |
||
def dockerComposeFile = buildArch == 'arm64' ? 'docker-compose.build-m1.yaml' : 'docker-compose.build.yaml' | ||
doFirst { | ||
exec { | ||
workingDir rootDir | ||
commandLine 'docker-compose', '-f', dockerComposeFile, 'build', '--parallel', '--quiet' | ||
environment 'VERSION', buildTag | ||
environment 'DOCKER_BUILD_PLATFORM', buildPlatform | ||
environment 'DOCKER_BUILD_ARCH', buildArch | ||
environment 'JDK_VERSION', jdkVersion | ||
} | ||
} | ||
} | ||
|
||
if (!System.getenv().containsKey("SUB_BUILD") || System.getenv().get("SUB_BUILD") == "PLATFORM") { | ||
build.dependsOn(composeBuild) | ||
} | ||
|
||
task('generate') { | ||
dependsOn subprojects.collect { it.getTasksByName('generateProtocolClassFiles', true) } | ||
dependsOn subprojects.collect { it.getTasksByName('generateJsonSchema2Pojo', true) } | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exciting
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto!