将 TagUI RPA 作为 Lambda 函数运行
我正在尝试使用容器图像将简单的 TagUI 流程作为 Lambda 函数运行。我使用 本教程中的 bootstrap 和 function.sh 创建了一个 Dockerfile :
FROM amazon/aws-lambda-provided:al2
RUN yum install -y wget nano php java-1.8.0-openjdk unzip procps
RUN curl https://intoli.com/install-google-chrome.sh | bash
RUN wget https://github.com/kelaberetiv/TagUI/releases/download/v6.46.0/TagUI_Linux.zip \
&& unzip TagUI_Linux.zip \
&& rm TagUI_Linux.zip \
&& ln -sf /var/task/tagui/src/tagui /usr/local/bin/tagui \
&& tagui update
RUN sed -i 's/no_sandbox_switch=""/no_sandbox_switch="--no-sandbox"/' /var/task/tagui/src/tagui
ADD tr.tag /var/task/tagui/src/tr.tag
WORKDIR /var/runtime/
COPY bootstrap bootstrap
RUN chmod 755 bootstrap
WORKDIR /var/task/
COPY function.sh function.sh
RUN chmod 755 function.sh
CMD [ "function.sh.handler" ]
我的 function.sh:
function handler () {
cp -r /var/task/tagui/src/* /tmp;
chmod 755 /tmp/tagui;
OUTPUT=$(/tmp/tagui /tmp/tr.tag -h);
echo "${OUTPUT}";
}
注释:
- 需要 sed 行才能在 docker 镜像中运行 TagUI。
- tr.tag 只是在 Web 应用程序上重置密码的简单流程,以便我可以确认容器已运行。
- 所有内容都必须在 /tmp 中运行,因为这是 Lambda 可以在容器中写入的唯一文件夹,并且 TagUI 在执行期间会创建大量临时文件。
当我作为 Lambda 运行时,出现错误:
./tmp/tagui/src/tagui: line 398: 56 Trace/breakpoint trap (core dumped) $chrome_command --user-data-dir="$TAGUI_DIR/ chrome/tagui_user_profile" $chrome_switches $window_size $headless_switch $no_sandbox_switch > /dev/null 2>&1
当我从 Docker 运行容器时,它运行得很好。我尝试增加函数的内存和超时。
我试图实现的最终目标是让 API 网关触发 Lambda 函数,该函数可以接收 TagUI RPA 流并运行它。
I am trying to run a simple TagUI flow as a Lambda function using container images. I have made a Dockerfile using the bootstrap and function.sh from this tutorial:
FROM amazon/aws-lambda-provided:al2
RUN yum install -y wget nano php java-1.8.0-openjdk unzip procps
RUN curl https://intoli.com/install-google-chrome.sh | bash
RUN wget https://github.com/kelaberetiv/TagUI/releases/download/v6.46.0/TagUI_Linux.zip \
&& unzip TagUI_Linux.zip \
&& rm TagUI_Linux.zip \
&& ln -sf /var/task/tagui/src/tagui /usr/local/bin/tagui \
&& tagui update
RUN sed -i 's/no_sandbox_switch=""/no_sandbox_switch="--no-sandbox"/' /var/task/tagui/src/tagui
ADD tr.tag /var/task/tagui/src/tr.tag
WORKDIR /var/runtime/
COPY bootstrap bootstrap
RUN chmod 755 bootstrap
WORKDIR /var/task/
COPY function.sh function.sh
RUN chmod 755 function.sh
CMD [ "function.sh.handler" ]
My function.sh:
function handler () {
cp -r /var/task/tagui/src/* /tmp;
chmod 755 /tmp/tagui;
OUTPUT=$(/tmp/tagui /tmp/tr.tag -h);
echo "${OUTPUT}";
}
Notes:
- the sed line is required to get TagUI running in docker images.
- tr.tag is just a simple flow to do a password reset on a webapp so I can confirm the container has run.
- everything has to be run in /tmp as that is the only folder Lambda can write to in the container and TagUI creates a load of temporary files during execution.
When I run as a Lambda I get the error:
./tmp/tagui/src/tagui: line 398: 56 Trace/breakpoint trap (core dumped) $chrome_command --user-data-dir="$TAGUI_DIR/chrome/tagui_user_profile" $chrome_switches $window_size $headless_switch $no_sandbox_switch > /dev/null 2>&1
When I run the container from Docker it runs perfectly. I have tried increasing both the memory and timeout of the function.
The end goal I am trying to achieve is to have a Lambda function triggered by an API gateway that can receive a TagUI RPA flow and run it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论