mirror of
https://github.com/google/nomulus.git
synced 2025-04-29 11:37: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
|
||||
ENV DEBIAN_FRONTEND=noninteractive LANG=en_US.UTF-8
|
||||
# Add script for cloud scheduler deployer
|
||||
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 .
|
||||
RUN ["bash", "./build.sh"]
|
||||
|
||||
|
|
|
@ -40,9 +40,16 @@ apt-get install lsb-release -y
|
|||
export CLOUD_SDK_REPO="cloud-sdk-$(lsb_release -c -s)"
|
||||
echo "deb http://packages.cloud.google.com/apt $CLOUD_SDK_REPO main" \
|
||||
| tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
|
||||
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg \
|
||||
| apt-key add -
|
||||
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | 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 install postgresql-client-11 procps -y
|
||||
|
||||
apt-get install google-cloud-sdk-app-engine-java -y
|
||||
# Install git
|
||||
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
|
||||
# Install libxss1 (needed by Karma)
|
||||
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 autoclean -y
|
||||
apt-get autoremove -y
|
||||
|
|
|
@ -107,7 +107,7 @@ steps:
|
|||
- -c
|
||||
- |
|
||||
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} \
|
||||
gcr.io/${PROJECT_ID}/schema_deployer:latest
|
||||
docker push gcr.io/${PROJECT_ID}/schema_deployer:latest
|
||||
|
@ -120,7 +120,7 @@ steps:
|
|||
- -c
|
||||
- |
|
||||
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} \
|
||||
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),
|
||||
# as a GCP application we prefer to start with a GCP-approved base image.
|
||||
FROM marketplace.gcr.io/google/debian10
|
||||
ENV DEBIAN_FRONTEND=noninteractive LANG=en_US.UTF-8
|
||||
# Install openjdk-11
|
||||
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
|
||||
ARG PROJECT_ID
|
||||
ARG TAG_NAME
|
||||
FROM gcr.io/${PROJECT_ID}/builder:${TAG_NAME}
|
||||
|
||||
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 \
|
||||
FLYWAY_MAVEN=https://repo1.maven.org/maven2/org/flywaydb/flyway-commandline \
|
||||
&& FLYWAY_VERSION=$(curl ${FLYWAY_MAVEN}/maven-metadata.xml \
|
||||
|
|
|
@ -21,34 +21,11 @@
|
|||
#
|
||||
# Please refer to verify_deployed_sql_schema.sh for expected volumes and
|
||||
# arguments.
|
||||
|
||||
FROM marketplace.gcr.io/google/debian10
|
||||
ENV DEBIAN_FRONTEND=noninteractive LANG=en_US.UTF-8
|
||||
# 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
|
||||
ARG PROJECT_ID
|
||||
ARG TAG_NAME
|
||||
FROM gcr.io/${PROJECT_ID}/builder:${TAG_NAME}
|
||||
|
||||
COPY verify_deployed_sql_schema.sh /usr/local/bin/
|
||||
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" ]
|
||||
|
|
Loading…
Add table
Reference in a new issue