mirror of
https://github.com/google/nomulus.git
synced 2025-08-04 00:42:12 +02:00
Containerize GCP proxy
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=186002010
This commit is contained in:
parent
6e4b2bd6a8
commit
edc50bbe59
2 changed files with 83 additions and 0 deletions
24
java/google/registry/proxy/Dockerfile
Normal file
24
java/google/registry/proxy/Dockerfile
Normal file
|
@ -0,0 +1,24 @@
|
|||
# Copyright 2018 The Nomulus Authors. All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
FROM openjdk:8
|
||||
|
||||
WORKDIR /proxy
|
||||
|
||||
COPY ./proxy_server_deploy.jar /proxy/
|
||||
|
||||
ENTRYPOINT ["java", "-jar", "proxy_server_deploy.jar"]
|
||||
|
||||
# Ports used for health checking, EPP and WHOIS, respecitvely.
|
||||
EXPOSE 11111 22222 12345
|
59
java/google/registry/proxy/build_image.sh
Executable file
59
java/google/registry/proxy/build_image.sh
Executable file
|
@ -0,0 +1,59 @@
|
|||
#!/bin/bash
|
||||
# Copyright 2018 The Nomulus Authors. All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# This script builds the proxy jar file with all of its dependencies included,
|
||||
# then puts it in an image with a name compatible with GCR. If a "push"
|
||||
# argument is given, it also uploads the image to GCR.
|
||||
|
||||
function cleanup() {
|
||||
rm ${WORKDIR}/${TARGET} -f
|
||||
}
|
||||
|
||||
trap cleanup EXIT
|
||||
|
||||
PROJECT=`gcloud config list 2>&1 | grep project | awk -F'= ' '{print $2}'`;
|
||||
|
||||
PACKAGE_PREFIX=""
|
||||
|
||||
PACKAGE=${PACKAGE_PREFIX}"java/google/registry/proxy"
|
||||
|
||||
TARGET=proxy_server_deploy.jar
|
||||
|
||||
BUILD_TOOL=bazel
|
||||
|
||||
WORKSPACE=`$BUILD_TOOL info workspace`
|
||||
|
||||
WORKDIR=${WORKSPACE}/${PACKAGE}
|
||||
|
||||
BINDIR=${WORKSPACE}/${BUILD_TOOL}-bin/${PACKAGE}
|
||||
|
||||
$BUILD_TOOL build "//"${PACKAGE}:${TARGET}
|
||||
|
||||
cp ${BINDIR}/${TARGET} ${WORKDIR}/
|
||||
|
||||
docker build -t gcr.io/${PROJECT}/proxy:latest $WORKDIR
|
||||
|
||||
# Publish the image to GCR if "push" argument is given.
|
||||
if [ -z $1 ]
|
||||
then
|
||||
exit
|
||||
fi
|
||||
|
||||
if [ $1 = "push" ]
|
||||
then
|
||||
gcloud docker -- push gcr.io/${PROJECT}/proxy:latest
|
||||
else
|
||||
echo "usage: $0 [push]"
|
||||
fi
|
Loading…
Add table
Add a link
Reference in a new issue