🐳 Improving env handling of docker containers
This commit is contained in:
parent
dc84422f69
commit
2f30a8b9ce
13
Dockerfile
13
Dockerfile
|
@ -1,13 +1,24 @@
|
|||
FROM node:14.16.0
|
||||
|
||||
# Create working directory and copy required code files
|
||||
RUN mkdir /workdir
|
||||
ADD bot.js /workdir/bot.js
|
||||
ADD package.json /workdir/package.json
|
||||
ADD package-lock.json /workdir/package-lock.json
|
||||
ADD .env /workdir/.env
|
||||
|
||||
# Set the working directory
|
||||
WORKDIR /workdir
|
||||
|
||||
# Install npm packages
|
||||
RUN npm i
|
||||
|
||||
# Declare required environment variables
|
||||
ENV API_BEARER ""
|
||||
ENV IRC_OAUTH ""
|
||||
ENV ACCESS_KEY ""
|
||||
|
||||
# Rewrite .env file every time the container starts
|
||||
CMD "echo \"API_BEARER=$API_BEARER\nIRC_OAUTH=$IRC_OAUTH\nACCESS_KEY=$ACCESS_KEY\" > /workdir/.env"
|
||||
CMD "cat .env"
|
||||
# Start the bot
|
||||
CMD ["node", "bot.js"]
|
||||
|
|
Loading…
Reference in New Issue
Block a user