【发布时间】:2015-09-01 14:57:37
【问题描述】:
我刚刚开始关注Docker。我有一个节点应用程序可以调整大小和图像,然后在完成后向aws 发送SQS 消息。我设法创建了我的应用程序的 docker 映像,从我的本地计算机复制它,但遇到了我无法设置包含我的 client_id 和 client_secret 的 AWS 变量来发送SQS 消息。
以前有人遇到过这个问题吗?
我需要在dockerfile 中写入哪些命令才能设置aws 变量?
这是我的dockerfile:
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 "https://s3.amazonaws.com/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
【问题讨论】:
标签: node.js amazon-web-services docker