I was wondering what the correct path structure is for doing a Volume mapping in a Dockerrun.aws.json to that I could reference installed node_modules in a '/opt/elasticbeanstalk/hooks/appdeploy/post' bash file. In short, I am trying to run Sequelize migrations after a deploy and cannot seem to expose the node_modules path to the host environment.
My Dockerfile
FROM node:6.10
ENV USER root
RUN mkdir -p /install/
ENV PATH /install/node_modules/.bin:$PATH
ENV NODE_PATH /install/node_modules/
COPY ./package.json /install/package.json
RUN cd install; npm install
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
COPY . /usr/src/app
RUN groupadd -r nodejs && useradd -m -r -g nodejs nodejs
USER nodejs
EXPOSE 3000
CMD [ "npm", "start" ]
Dockerrun.aws.json
{
"AWSEBDockerrunVersion": "1",
"Logging": "/var/log/pm2",
"Volumes": [
{
"HostDirectory": "/var/app/current",
"ContainerDirectory": "/usr/src/app"
},
{
"HostDirectory": "/var/app/current/node_modules",
"ContainerDirectory": "/install"
}
]
}
This works fine without the '"/var/app/current/node_modules' mapping but fails with it (I'm guessing because the /install directory is invalid)
Thanks, Steve
via daxiang28
No comments:
Post a Comment