Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 16 additions & 13 deletions java-bigquery/google-cloud-bigquery-jdbc/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
FROM gcr.io/cloud-devrel-public-resources/java11

ARG BRANCH=main
ENV JDBC_DOCKER_ENV=true
RUN apt-get update && apt-get install -y zip && rm -rf /var/lib/apt/lists/*

RUN mkdir /tst
COPY ./pom.xml /src/pom.xml
COPY ./java.header /src/java.header
COPY ./license-checks.xml /src/license-checks.xml
COPY ./google-cloud-bigquery-jdbc/pom.xml /src/google-cloud-bigquery-jdbc/pom.xml

COPY ./google-cloud-bigquery /src/google-cloud-bigquery
COPY ./google-cloud-bigquery-bom /src/google-cloud-bigquery-bom
# Changes to `pom.xml` will trigger re-sync
COPY pom.xml /src/pom.xml

# Doing it via single command, so layer contains only installed moduled vs full repo
# Copy from local repo is taking forever. Doing via git clone will keep dependencies ~up to date.
# It will fail on old branches forcing to sync to latest main branch.
RUN bash -c " \
mkdir /git \
&& cd /git \
&& git clone -b ${BRANCH} --depth 1 --single-branch https://github.com/googleapis/google-cloud-java.git \
&& cd /git/google-cloud-java \
&& source .kokoro/common.sh \
&& install_modules java-bigquery \
&& rm -rf /git"
Comment thread
logachev marked this conversation as resolved.

# This will ensure all deps are present
WORKDIR /src
RUN mvn install -DskipTests

WORKDIR /src/google-cloud-bigquery-jdbc
RUN mvn install

ENTRYPOINT []
10 changes: 7 additions & 3 deletions java-bigquery/google-cloud-bigquery-jdbc/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
SHELL := /bin/bash # Default 'sh' doesn't support 'source'
BUILD_BRANCH=main
CONTAINER_NAME=jdbc
PACKAGE_DESTINATION=$(PWD)/drivers
SRC="$(PWD)/.."
SRC="$(PWD)"
skipSurefire ?= true

# no indendation for ifndef\endif due to their evaluation before execution
Expand All @@ -10,7 +12,9 @@ ifndef GOOGLE_APPLICATION_CREDENTIALS
endif

install:
mvn clean install
cd "$(PWD)/../.." && \
source ".kokoro/common.sh" && \
install_modules java-bigquery

clean:
mvn clean
Expand Down Expand Up @@ -77,7 +81,7 @@ generate-dependency-list:
$(CONTAINER_NAME) $(args)

docker-build:
docker build -t $(CONTAINER_NAME) -f Dockerfile ..
docker build -t $(CONTAINER_NAME) -f Dockerfile --build-arg BRANCH=${BUILD_BRANCH} $(SRC)

docker-session:
$(MAKE) .docker-run args="bash"
Expand Down
4 changes: 4 additions & 0 deletions java-bigquery/google-cloud-bigquery-jdbc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,10 @@
<!-- Ensure it doesn't conflict with local build directories -->
<directory>/mvn/test-target</directory>
</build>
<properties>
<!-- Disable to avoid bringing license-checks to docker env -->
<checkstyle.skip>true</checkstyle.skip>
</properties>
</profile>
</profiles>
</project>
Loading