0

this is my dockerfile. environment variables was not recognized.
However, hardcoded environment variables were successfully recognized. like 'DOMAIN' or 'NOTICE_FILE_PATH' were successfully recognized.

MAINTAINER JeongWooYeong(wjd030811@gmail.com)

ENV SECRET_KEY_BASE $SECRET_KEY_BASE
ENV SCARFS_PASSWORD $SCARFS_PASSWORD
ENV API_KEY $API_KEY
ENV DOMAIN dsm-scarfs.hs.kr
ENV NOTICE_FILE_PATH /home/ubuntu/scarfs/storage/notice_file
ENV EXCEL_FILE_PATH /home/ubuntu/scarfs/storage/excel_file
ENV SINGLE_FILE_PATH /home/ubuntu/scarfs/storage/single_file
ENV MULTI_FILE_PATH /home/ubuntu/scarfs/storage/multi_file
ENV SCARFS_DB $SCARFS_DB

RUN apt-get update && \
    apt-get install -y \
    default-libmysqlclient-dev \
    nodejs

RUN gem install bundler

COPY . .
WORKDIR .

RUN bundle install

EXPOSE 3000
VOLUME [".storage", "/home/ubuntu/T-bone"]
RUN  ["bundle", "exec", "unicorn", "-E", "production", "-c", "config/unicorn.rb"]

and it caused the following error:

ArgumentError: `secret_key_base` for production environment must be a type of String`

what can i do?

  • What are you expecting the value of that environment variable to be? Does your `docker build` stage ever actually complete? – David Maze Feb 10 '20 at 17:13
  • nope:( it doesn't work.. – Jeong woo yeong Feb 10 '20 at 17:19
  • You probably want the last line of your `Dockerfile` to be `CMD [...]` so it runs when you `docker run` the resulting image, not during the build sequence. You should probably also delete the `VOLUME` line (it mostly only has confusing side effects). I’m not sure what the `ENV SECRET_KEY_BASE` line should do. – David Maze Feb 10 '20 at 17:53

0 Answers0