sách gpt4 ai đã đi

Cấu hình Dockerfile để thiết lập cấu hình AWS

In lại 作者:太空宇宙 更新时间:2023-11-04 02:57:53 30 4
mua khóa gpt4 Nike

我刚刚开始研究Docker。我有一个 Node 应用程序,可以调整大小和图像,然后在完成后向 aws 发送 SQS 消息。我已成功创建应用程序的 docker 镜像,并从本地计算机复制它,但遇到了无法设置包含 client_idclient_secret của AWS 变量来发送 SQS 消息的问题。

以前有人遇到过这个问题吗?

我需要在 dockerfile 中编写哪些命令才能设置 aws 变量?

Đây là của tôidockerfile:

FROM ubuntu:latest

#install node and npm
RUN apt-get update && \
apt-get -y install curl && \
curl -sL https://deb.nodesource.com/setup | sudo bash - && \
apt-get -y install python build-essential nodejs

#install imagemagick, graphicsmagick and set-up aws-cli to send SQS messages
RUN sudo apt-get -y install imagemagick
RUN sudo apt-get -y install graphicsmagick
RUN sudo apt-get install unzip
RUN curl "../../../aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip"
RUN unzip awscli-bundle.zip
RUN sudo ./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws

#set-up environment variables for AWS


#at some point set-up git and fetch repository from git


# Provides cached layer for node_modules
ADD package.json /tmp/package.json
RUN cd /tmp && npm install
RUN mkdir -p /home/image-resizer && cp -a /tmp/node_modules /home/image-resizer/

#bundle source code into image
COPY . /home/image-resizer

1 Câu trả lời

Bạn có thể sử dụngENV在docker中设置环境变量。例如。

ENV PORT=9000
ENV LANG=en_US.utf8

但是, secret 信息不应嵌入到 Dockerfile 中,您可以使用 -e 参数传递或使用文本文件并通过 --env-file 参数传递给 docker。当使用 SVN 或 git 时,您应该忽略该文本文件。

关于node.js - 配置 Dockerfile 以设置 AWS 配置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30873539/

30 4 0
太空宇宙
Hồ sơ cá nhân

Tôi là một lập trình viên xuất sắc, rất giỏi!

Nhận phiếu giảm giá Didi Taxi miễn phí
Mã giảm giá Didi Taxi
Giấy chứng nhận ICP Bắc Kinh số 000000
Hợp tác quảng cáo: 1813099741@qq.com 6ren.com