mirror of
https://github.com/google/nomulus.git
synced 2025-04-29 19:47:51 +02:00
Use builder image as a base for schema-deployer and schema-verifier (#1955)
This commit is contained in:
parent
d996ef974c
commit
59f457b2d7
5 changed files with 28 additions and 46 deletions
|
@ -29,6 +29,13 @@ RUN go build -o /cloudSchedulerDeployer
|
||||||
|
|
||||||
FROM marketplace.gcr.io/google/debian10
|
FROM marketplace.gcr.io/google/debian10
|
||||||
ENV DEBIAN_FRONTEND=noninteractive LANG=en_US.UTF-8
|
ENV DEBIAN_FRONTEND=noninteractive LANG=en_US.UTF-8
|
||||||
|
# Add script for cloud scheduler deployer
|
||||||
COPY --from=cloudSchedulerBuilder /cloudSchedulerDeployer /usr/local/bin/cloudSchedulerDeployer
|
COPY --from=cloudSchedulerBuilder /cloudSchedulerDeployer /usr/local/bin/cloudSchedulerDeployer
|
||||||
|
# Add Cloud sql connector
|
||||||
|
ADD https://dl.google.com/cloudsql/cloud_sql_proxy.linux.amd64 \
|
||||||
|
/usr/local/bin/cloud_sql_proxy
|
||||||
|
RUN chmod +x /usr/local/bin/cloud_sql_proxy
|
||||||
|
|
||||||
ADD ./build.sh .
|
ADD ./build.sh .
|
||||||
RUN ["bash", "./build.sh"]
|
RUN ["bash", "./build.sh"]
|
||||||
|
|
||||||
|
|
|
@ -40,9 +40,16 @@ apt-get install lsb-release -y
|
||||||
export CLOUD_SDK_REPO="cloud-sdk-$(lsb_release -c -s)"
|
export CLOUD_SDK_REPO="cloud-sdk-$(lsb_release -c -s)"
|
||||||
echo "deb http://packages.cloud.google.com/apt $CLOUD_SDK_REPO main" \
|
echo "deb http://packages.cloud.google.com/apt $CLOUD_SDK_REPO main" \
|
||||||
| tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
|
| tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
|
||||||
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg \
|
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
|
||||||
| apt-key add -
|
# Install pg_dump v11 (same as current server version). This needs to be
|
||||||
|
# downloaded from postgresql's own repo, because ubuntu1804 is too old. With a
|
||||||
|
# newer image 'apt-get install postgresql-client-11' may be sufficient.
|
||||||
|
curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
|
||||||
|
sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" \
|
||||||
|
> /etc/apt/sources.list.d/pgdg.list'
|
||||||
apt-get update -y
|
apt-get update -y
|
||||||
|
apt-get install postgresql-client-11 procps -y
|
||||||
|
|
||||||
apt-get install google-cloud-sdk-app-engine-java -y
|
apt-get install google-cloud-sdk-app-engine-java -y
|
||||||
# Install git
|
# Install git
|
||||||
apt-get install git -y
|
apt-get install git -y
|
||||||
|
@ -54,6 +61,10 @@ wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
|
||||||
apt install ./google-chrome-stable_current_amd64.deb -y
|
apt install ./google-chrome-stable_current_amd64.deb -y
|
||||||
# Install libxss1 (needed by Karma)
|
# Install libxss1 (needed by Karma)
|
||||||
apt install libxss1
|
apt install libxss1
|
||||||
|
# Use unzip to extract files from jars.
|
||||||
|
apt-get install zip -y
|
||||||
|
# Get netstat, used for checking Cloud SQL proxy readiness.
|
||||||
|
apt-get install net-tools
|
||||||
apt-get remove apt-utils locales -y
|
apt-get remove apt-utils locales -y
|
||||||
apt-get autoclean -y
|
apt-get autoclean -y
|
||||||
apt-get autoremove -y
|
apt-get autoremove -y
|
||||||
|
|
|
@ -107,7 +107,7 @@ steps:
|
||||||
- -c
|
- -c
|
||||||
- |
|
- |
|
||||||
set -e
|
set -e
|
||||||
docker build -t gcr.io/${PROJECT_ID}/schema_deployer:${TAG_NAME} .
|
docker build -t gcr.io/${PROJECT_ID}/schema_deployer:${TAG_NAME} --build-arg TAG_NAME=${TAG_NAME} --build-arg PROJECT_ID=${PROJECT_ID} .
|
||||||
docker tag gcr.io/${PROJECT_ID}/schema_deployer:${TAG_NAME} \
|
docker tag gcr.io/${PROJECT_ID}/schema_deployer:${TAG_NAME} \
|
||||||
gcr.io/${PROJECT_ID}/schema_deployer:latest
|
gcr.io/${PROJECT_ID}/schema_deployer:latest
|
||||||
docker push gcr.io/${PROJECT_ID}/schema_deployer:latest
|
docker push gcr.io/${PROJECT_ID}/schema_deployer:latest
|
||||||
|
@ -120,7 +120,7 @@ steps:
|
||||||
- -c
|
- -c
|
||||||
- |
|
- |
|
||||||
set -e
|
set -e
|
||||||
docker build -t gcr.io/${PROJECT_ID}/schema_verifier:${TAG_NAME} .
|
docker build -t gcr.io/${PROJECT_ID}/schema_verifier:${TAG_NAME} --build-arg TAG_NAME=${TAG_NAME} --build-arg PROJECT_ID=${PROJECT_ID} .
|
||||||
docker tag gcr.io/${PROJECT_ID}/schema_verifier:${TAG_NAME} \
|
docker tag gcr.io/${PROJECT_ID}/schema_verifier:${TAG_NAME} \
|
||||||
gcr.io/${PROJECT_ID}/schema_verifier:latest
|
gcr.io/${PROJECT_ID}/schema_verifier:latest
|
||||||
docker push gcr.io/${PROJECT_ID}/schema_verifier:latest
|
docker push gcr.io/${PROJECT_ID}/schema_verifier:latest
|
||||||
|
|
|
@ -23,24 +23,11 @@
|
||||||
|
|
||||||
# Although any Linux-based Java image with bash would work (e.g., openjdk:11),
|
# Although any Linux-based Java image with bash would work (e.g., openjdk:11),
|
||||||
# as a GCP application we prefer to start with a GCP-approved base image.
|
# as a GCP application we prefer to start with a GCP-approved base image.
|
||||||
FROM marketplace.gcr.io/google/debian10
|
ARG PROJECT_ID
|
||||||
ENV DEBIAN_FRONTEND=noninteractive LANG=en_US.UTF-8
|
ARG TAG_NAME
|
||||||
# Install openjdk-11
|
FROM gcr.io/${PROJECT_ID}/builder:${TAG_NAME}
|
||||||
RUN apt-get update -y \
|
|
||||||
&& apt-get install locales -y \
|
|
||||||
&& locale-gen en_US.UTF-8 \
|
|
||||||
&& apt-get install apt-utils -y \
|
|
||||||
&& apt-get upgrade -y \
|
|
||||||
&& apt-get install openjdk-11-jdk-headless curl procps -y
|
|
||||||
|
|
||||||
# Get netstat, used for checking Cloud SQL proxy readiness.
|
|
||||||
RUN apt-get install net-tools
|
|
||||||
|
|
||||||
COPY deploy_sql_schema.sh /usr/local/bin/
|
COPY deploy_sql_schema.sh /usr/local/bin/
|
||||||
ADD https://dl.google.com/cloudsql/cloud_sql_proxy.linux.amd64 \
|
|
||||||
/usr/local/bin/cloud_sql_proxy
|
|
||||||
RUN chmod +x /usr/local/bin/cloud_sql_proxy
|
|
||||||
# Adapted from https://github.com/flyway/flyway-docker/blob/master/Dockerfile
|
|
||||||
RUN \
|
RUN \
|
||||||
FLYWAY_MAVEN=https://repo1.maven.org/maven2/org/flywaydb/flyway-commandline \
|
FLYWAY_MAVEN=https://repo1.maven.org/maven2/org/flywaydb/flyway-commandline \
|
||||||
&& FLYWAY_VERSION=$(curl ${FLYWAY_MAVEN}/maven-metadata.xml \
|
&& FLYWAY_VERSION=$(curl ${FLYWAY_MAVEN}/maven-metadata.xml \
|
||||||
|
|
|
@ -21,34 +21,11 @@
|
||||||
#
|
#
|
||||||
# Please refer to verify_deployed_sql_schema.sh for expected volumes and
|
# Please refer to verify_deployed_sql_schema.sh for expected volumes and
|
||||||
# arguments.
|
# arguments.
|
||||||
|
ARG PROJECT_ID
|
||||||
FROM marketplace.gcr.io/google/debian10
|
ARG TAG_NAME
|
||||||
ENV DEBIAN_FRONTEND=noninteractive LANG=en_US.UTF-8
|
FROM gcr.io/${PROJECT_ID}/builder:${TAG_NAME}
|
||||||
# Install pg_dump v11 (same as current server version). This needs to be
|
|
||||||
# downloaded from postgresql's own repo, because ubuntu1804 is too old. With a
|
|
||||||
# newer image 'apt-get install postgresql-client-11' may be sufficient.
|
|
||||||
RUN apt-get update -y \
|
|
||||||
&& apt-get install locales -y \
|
|
||||||
&& locale-gen en_US.UTF-8 \
|
|
||||||
&& apt-get install curl gnupg lsb-release -y \
|
|
||||||
&& curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - \
|
|
||||||
&& sh -c \
|
|
||||||
'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" \
|
|
||||||
> /etc/apt/sources.list.d/pgdg.list' \
|
|
||||||
&& apt-get update -y \
|
|
||||||
&& apt install postgresql-client-11 procps -y
|
|
||||||
|
|
||||||
# Use unzip to extract files from jars.
|
|
||||||
RUN apt-get install zip -y
|
|
||||||
|
|
||||||
# Get netstat, used for checking Cloud SQL proxy readiness.
|
|
||||||
RUN apt-get install net-tools
|
|
||||||
|
|
||||||
COPY verify_deployed_sql_schema.sh /usr/local/bin/
|
COPY verify_deployed_sql_schema.sh /usr/local/bin/
|
||||||
COPY allowed_diffs.txt /
|
COPY allowed_diffs.txt /
|
||||||
|
|
||||||
ADD https://dl.google.com/cloudsql/cloud_sql_proxy.linux.amd64 \
|
|
||||||
/usr/local/bin/cloud_sql_proxy
|
|
||||||
RUN chmod +x /usr/local/bin/cloud_sql_proxy
|
|
||||||
|
|
||||||
ENTRYPOINT [ "verify_deployed_sql_schema.sh" ]
|
ENTRYPOINT [ "verify_deployed_sql_schema.sh" ]
|
||||||
|
|
Loading…
Add table
Reference in a new issue