我创建了一个节点快速应用程序,它充当基于wkhtmltopdf插件的print api。
我正在尝试将其部署到Google Cloud Platform,但我需要先在Google Cloud Platform上安装wkhtmltopdf二进制文件。
我该怎么做?我正在使用Google App Engine服务。
使用自定义运行时创建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/
您将需要构建自定义运行时。来自About Custom Runtimes:
自定义运行时允许您定义新的运行时环境,其中可能包括其他组件,如语言解释器或应用程序服务器。
从Building Custom Runtimes(你应该通过整个文档):
要创建自定义运行时,您需要:
- 一个描述应用程序运行时配置的
app.yaml
文件。- 配置运行时环境的
Dockerfile
。在许多情况下,这可以只是指定基本图像的一行。- 确保您的应用程序正在侦听端口8080,并具有响应生命周期事件的请求处理程序,例如启动,停止和运行状况检查请求。