在谷歌云平台上安装wkpdtothtml

时间:2018-01-10 16:16:29

标签: javascript node.js google-app-engine google-cloud-platform

我创建了一个节点快速应用程序,它充当基于wkhtmltopdf插件的print api。

我正在尝试将其部署到Google Cloud Platform,但我需要先在Google Cloud Platform上安装wkhtmltopdf二进制文件。

我该如何解决这个问题?我正在使用Google App Engine服务。

2 个答案:

答案 0 :(得分:1)

使用自定义运行时创建一个app.yaml文件,如下所示:

runtime: custom
env: flex

创建一个Dockerfile来安装一些第三方服务。示例nginx图像如下:

# Debian-based Linux operating system based on free software.
FROM ubuntu

# Install wkhtmltopdf
WORKDIR ~
RUN wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.3/wkhtmltox-0.12.3_linux-generic-amd64.tar.xz
RUN tar vxf wkhtmltox-0.12.3_linux-generic-amd64.tar.xz 
RUN cp wkhtmltox/bin/wk* /usr/local/bin/

答案 1 :(得分:0)

您需要构建自定义运行时。来自About Custom Runtimes

  

自定义运行时允许您定义新的运行时环境   可能包括其他组件,如语言解释器或   应用服务器。

来自Building Custom Runtimes(您应该通过整个文档):

  

要创建自定义运行时,您需要:

     
      
  • 描述应用程序运行时配置的app.yaml文件。
  •   
  • 配置运行时环境的Dockerfile。在许多情况下,这可能只是指定基本图像的一行。
  •   
  • 确保您的应用程序正在侦听端口8080,并具有响应生命周期事件的请求处理程序,例如启动,停止和   健康检查要求。
  •