From a3b451b408e015059fd3cc7e2f098c7b459e1ab7 Mon Sep 17 00:00:00 2001 From: abler98 Date: Fri, 4 Sep 2020 19:03:23 +0300 Subject: [PATCH 1/2] Add support for Protoc in workspace --- docker-compose.yml | 2 ++ env-example | 2 ++ workspace/Dockerfile | 21 +++++++++++++++++++++ 3 files changed, 25 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index bda44f27..8f128315 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -151,6 +151,8 @@ services: - INSTALL_FFMPEG=${WORKSPACE_INSTALL_FFMPEG} - INSTALL_WKHTMLTOPDF=${WORKSPACE_INSTALL_WKHTMLTOPDF} - INSTALL_GNU_PARALLEL=${WORKSPACE_INSTALL_GNU_PARALLEL} + - INSTALL_PROTOC=${WORKSPACE_INSTALL_PROTOC} + - PROTOC_VERSION=${WORKSPACE_PROTOC_VERSION} - http_proxy - https_proxy - no_proxy diff --git a/env-example b/env-example index b08825b5..6d422cb3 100644 --- a/env-example +++ b/env-example @@ -178,6 +178,8 @@ WORKSPACE_VUE_CLI_SERVE_HOST_PORT=8080 WORKSPACE_VUE_CLI_UI_HOST_PORT=8001 WORKSPACE_ANGULAR_CLI_SERVE_HOST_PORT=4200 WORKSPACE_INSTALL_GIT_PROMPT=false +WORKSPACE_INSTALL_PROTOC=false +WORKSPACE_PROTOC_VERSION=latest ### PHP_FPM ############################################### diff --git a/workspace/Dockerfile b/workspace/Dockerfile index f5a88468..1c5c2182 100644 --- a/workspace/Dockerfile +++ b/workspace/Dockerfile @@ -1376,6 +1376,27 @@ RUN if [ ${INSTALL_XMLRPC} = true ]; then \ docker-php-ext-install xmlrpc \ ;fi +########################################################################### +# Protoc: +########################################################################### + +ARG INSTALL_PROTOC=false +ARG PROTOC_VERSION + +RUN if [ ${INSTALL_PROTOC} = true ]; then \ + if [ ${PROTOC_VERSION} = "latest" ]; then \ + REAL_PROTOC_VERSION=$(curl -s https://api.github.com/repos/protocolbuffers/protobuf/releases/latest | \ + sed -nr 's/.*"tag_name":\s?"v(.+?)".*/\1/p'); \ + else \ + REAL_PROTOC_VERSION=${PROTOC_VERSION}; \ + fi && \ + PROTOC_ZIP=protoc-${REAL_PROTOC_VERSION}-linux-x86_64.zip; \ + curl -L -o /tmp/protoc.zip https://github.com/protocolbuffers/protobuf/releases/download/v${REAL_PROTOC_VERSION}/${PROTOC_ZIP} && \ + unzip -q -o /tmp/protoc.zip -d /usr/local bin/protoc && \ + unzip -q -o /tmp/protoc.zip -d /usr/local 'include/*' && \ + rm -f /tmp/protoc.zip \ +;fi + ########################################################################### # Check PHP version: ########################################################################### From 6d77ff9277f354622f25d4f9006d317b82622ec3 Mon Sep 17 00:00:00 2001 From: "Shao Yu-Lung (Allen)" Date: Tue, 15 Sep 2020 22:58:26 +0800 Subject: [PATCH 2/2] Update Dockerfile --- workspace/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/workspace/Dockerfile b/workspace/Dockerfile index 0686013b..c0279b0d 100644 --- a/workspace/Dockerfile +++ b/workspace/Dockerfile @@ -1405,6 +1405,7 @@ RUN if [ ${INSTALL_PROTOC} = true ]; then \ unzip -q -o /tmp/protoc.zip -d /usr/local bin/protoc && \ unzip -q -o /tmp/protoc.zip -d /usr/local 'include/*' && \ rm -f /tmp/protoc.zip \ +;fi ########################################################################### # Check PHP version: