Код: Выделить всё
FROM node:20-alpine
# Install necessary packages and dependencies
USER root
RUN apk update && \
apk add --no-cache jq curl unzip && \
apk add --no-cache aws-cli
RUN aws --version
RUN pwd
COPY package*.json ./
COPY credentials.sh /opt/bin/credentials.sh
# Ensure the script has the correct line endings and is executable
RUN dos2unix /opt/bin/credentials.sh && chmod 755 /opt/bin/credentials.sh
RUN mkdir -p ~/.aws
RUN mkdir -p /root/.aws/
COPY config ~/.aws/config
COPY config /root/.aws/config
RUN ls -la /opt/bin
RUN cat /opt/bin/credentials.sh
# Run the script directly to ensure it executes
RUN /opt/bin/credentials.sh
RUN aws configure list
ENTRYPOINT ["node", "index.js"]
Код: Выделить всё
[default]
credential_process = /opt/bin/credentials.sh
Код: Выделить всё
credential_process
После всей этой настройки я хотел проверить, правильно ли настроен AWS, запустив список конфигурации aws > с помощью команды Docker RUN.
Однако при создании образа я сталкиваюсь со следующей ошибкой на этапе настройки списка RUN aws:
Код: Выделить всё
[23/23] RUN aws configure list:
0.730
0.730 [Errno 2] No such file or directory: '/opt/bin/credentials.sh'
Код: Выделить всё
/opt/bin/credentials.sh).#25 [19/23] RUN ls -la /opt/bin
#25 0.188 total 20
#25 0.189 drwxr-xr-x 1 root root 4096 May 31 14:25 .
#25 0.189 drwxr-xr-x 1 root root 4096 May 31 14:25 ..
#25 0.189 -rwxr-xr-x 1 root root 714 May 31 14:24 credentials.sh
Я пробовал
Код: Выделить всё
Checked file existence and permissions: The file exists and is executable.
Ensured correct line endings: I used dos2unix to ensure the script has Unix-style line endings.
Дополнительное примечание:
Я могу видеть содержимое файла при выполнении команды cat /opt/bin/ учетные данные.sh. Только при запуске выдает ошибку разрешения.
Подробнее здесь: https://stackoverflow.com/questions/785 ... als-sh-whe