github.com/apache/beam/sdks/v2@v2.48.2/java/transform-service/controller-container/build.gradle (about)

     1  /*
     2   * Licensed to the Apache Software Foundation (ASF) under one
     3   * or more contributor license agreements.  See the NOTICE file
     4   * distributed with this work for additional information
     5   * regarding copyright ownership.  The ASF licenses this file
     6   * to you under the Apache License, Version 2.0 (the
     7   * License); you may not use this file except in compliance
     8   * with the License.  You may obtain a copy of the License at
     9   *
    10   *     http://www.apache.org/licenses/LICENSE-2.0
    11   *
    12   * Unless required by applicable law or agreed to in writing, software
    13   * distributed under the License is distributed on an AS IS BASIS,
    14   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    15   * See the License for the specific language governing permissions and
    16   * limitations under the License.
    17   */
    18  
    19  
    20  apply plugin: 'org.apache.beam.module'
    21  
    22  applyDockerNature()
    23  applyGoNature()
    24  
    25  description = "Apache Beam :: SDKs :: Java :: Transform Service :: Controller Container"
    26  
    27  configurations {
    28      dockerDependency
    29  }
    30  
    31  dependencies {
    32      dockerDependency project(path: ":sdks:java:transform-service", configuration: "shadow")
    33  }
    34  
    35  goBuild {
    36      goTargets = '*.go' // only build the immediate directory.
    37      outputLocation = './build/target/launcher/${GOOS}_${GOARCH}/boot'
    38  }
    39  
    40  task copyDockerfileDependencies(type: Copy) {
    41      from configurations.dockerDependency
    42      rename 'beam-sdks-java-transform-service-.*.jar', 'beam-sdks-java-transform-service.jar'
    43      setDuplicatesStrategy(DuplicatesStrategy.INCLUDE)
    44      into "build/target"
    45  }
    46  
    47  task copyConfigFile(type: Copy) {
    48      from "../transform_service_config.yml"
    49      into "build/target"
    50  }
    51  
    52  docker {
    53      name containerImageName(
    54              name: project.docker_image_default_repo_prefix + "transform_service_controller",
    55              root: project.rootProject.hasProperty(["docker-repository-root"]) ?
    56                      project.rootProject["docker-repository-root"] :
    57                      project.docker_image_default_repo_root,
    58              tag: project.rootProject.hasProperty(["docker-tag"]) ?
    59                      project.rootProject["docker-tag"] : project.sdk_version)
    60      // tags used by dockerTag task
    61      tags containerImageTags()
    62      files "./build"
    63      buildx project.containerPlatforms() != [project.nativeArchitecture()]
    64      platform(*project.containerPlatforms())
    65  }
    66  
    67  dockerPrepare.dependsOn goBuild
    68  dockerPrepare.dependsOn copyConfigFile
    69  dockerPrepare.dependsOn copyDockerfileDependencies
    70  
    71  if (project.rootProject.hasProperty(["docker-pull-licenses"])) {
    72      def copyGolangLicenses = tasks.register("copyGolangLicenses", Copy) {
    73          from "${project(':release:go-licenses:py').buildDir}/output"
    74          into "build/target/go-licenses"
    75          dependsOn ':release:go-licenses:py:createLicenses'
    76      }
    77      dockerPrepare.dependsOn copyGolangLicenses
    78  } else {
    79      def skipPullLicenses = tasks.register("skipPullLicenses", Exec) {
    80          executable "sh"
    81          // Touch a dummy file to ensure the directory exists.
    82          args "-c", "mkdir -p build/target/go-licenses && touch build/target/go-licenses/skip"
    83      }
    84      dockerPrepare.dependsOn skipPullLicenses
    85  }
    86  
    87  task pushAll {
    88      dependsOn dockerPush
    89  }