首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >我可以使用nsq_to_file工具和码头组合吗?

我可以使用nsq_to_file工具和码头组合吗?
EN

Stack Overflow用户
提问于 2022-02-18 22:48:51
回答 1查看 67关注 0票数 0

在运行一些自动化代码时,我使用文件实用程序,我希望将该实用程序自动化为一个坞-组合服务。我找不到任何关于使用这个工具与码头有关的文档。我使用它的方式如下:

./nsq_to_file --lookupd-http-address=<http_address> --topic=ta-gcp-test -output-dir=/path/to/local/dir -filename-format=local_file_name

有人对此有意见吗?

EN

回答 1

Stack Overflow用户

发布于 2022-02-20 01:06:00

您可以使用nsq_to_file可执行文件构建一个Docker容器,如下所示:

代码语言:javascript
复制
#
# build container
#
FROM golang:1.17-alpine as builder

RUN apk update && apk add git
RUN git clone https://github.com/nsqio/nsq
RUN cd nsq/apps/nsq_to_file/ && CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s" -o /nsq_to_file .

#
# scratch release container
#
FROM scratch as scratch

COPY --from=builder /nsq_to_file /nsq_to_file
COPY --from=builder /etc/ssl/certs /etc/ssl/certs

# Run as non-root user for secure environments
USER 59000:59000

ENTRYPOINT [ "/nsq_to_file" ]

然后您可以构建它并运行它:

docker build -t oliver006/nsq_to_file -f Dockerfile .

docker run --rm oliver006/nsq_to_file --lookupd-http-address=<http_address> --topic=ta-gcp-test ...

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/71180717

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档