-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
6 changed files
with
78 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,3 +18,5 @@ pbjs-genfiles/ | |
.test-out-showcase | ||
.client_library | ||
*test-out* | ||
docker/package.tgz | ||
*.tgz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
FROM node:12-alpine | ||
|
||
# Create folder structure | ||
RUN mkdir -p /in | ||
RUN mkdir -p /out | ||
RUN mkdir -p /protos | ||
RUN mkdir -p /root/files | ||
|
||
# Install the generator | ||
COPY ./package.tgz /root/files/ | ||
RUN npm install -g /root/files/package.tgz | ||
|
||
# Download and install protoc | ||
RUN apk update && apk add libc6-compat && rm -f /var/cache/apk/* | ||
ENV LD_LIBRARY_PATH /lib64:$LD_LIBRARY_PATH | ||
RUN cd /root/files && \ | ||
wget https://github.com/protocolbuffers/protobuf/releases/download/v3.10.0/protoc-3.10.0-linux-x86_64.zip | ||
RUN cd /usr/local && unzip /root/files/protoc-3.10.0-linux-x86_64.zip | ||
|
||
# Download a copy of API common protos | ||
RUN cd /root/files && \ | ||
wget https://github.com/googleapis/api-common-protos/archive/master.zip | ||
RUN cd /protos && unzip /root/files/master.zip && chmod -R a+rx /protos | ||
|
||
# Copy the start script | ||
COPY ./start.sh /usr/local/bin/ | ||
RUN chmod +x /usr/local/bin/start.sh | ||
|
||
# Delete downloaded files | ||
RUN rm -rf /root/files | ||
|
||
# Print versions for debugging purposes | ||
RUN gapic-generator-typescript --version | ||
RUN protoc --version | ||
|
||
ENTRYPOINT [ "/usr/local/bin/start.sh" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/sh | ||
|
||
### Prepare the package and run `docker build` | ||
|
||
SCRIPTDIR=`dirname "$0"` | ||
cd "$SCRIPTDIR" | ||
cd .. # now in the package.json directory | ||
npm pack | ||
|
||
VERSION=`cat package.json | grep version | awk -F'"' '{ print $4; }'` | ||
|
||
cp "google-cloud-gapic-generator-$VERSION.tgz" "docker/package.tgz" | ||
cd docker | ||
|
||
docker build -t gapic-generator-typescript . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/sh | ||
|
||
### Start script that is an entry point for a Docker image. | ||
|
||
# Change directory to the input directory. | ||
# Make it easier to pass gRPC service config relative to it, e.g. | ||
# --grpc-service-config google/cloud/texttospeech/v1/texttospeech_grpc_service_config.json | ||
|
||
cd /in | ||
gapic-generator-typescript \ | ||
--common-proto-path /protos/api-common-protos-master \ | ||
-I /in \ | ||
--output-dir /out \ | ||
$* \ | ||
`find /in -name '*.proto'` | ||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters