Bitnami / Express 4.16.4-NPM安装

时间:2019-04-22 22:51:57

标签: docker npm bitnami

我需要在bitnami docker容器上安装其他node.js模块。
我想将body-parser模块安装到容器中。我已经使用sudo docker-compose启动了容器,并且运行良好。我试图修改dockerfile和docker-compose.yml文件以安装body-parser,但是我得到EACCES权限被拒绝,访问'/ app / node_modules'错误。你能帮忙吗?

TIA,

托马斯

****更新4/23/2019 *** 这是docker文件。
我添加了body-parser行。

## Dockerfile for building production image
FROM bitnami/express:4.16.4-debian-9-r166
LABEL maintainer "John Smith <john.smith@acme.com>"

ENV DISABLE_WELCOME_MESSAGE=1

ENV NODE_ENV=production \
    PORT=3000

# Skip fetching dependencies and database migrations for production image
ENV SKIP_DB_WAIT=0 \
    SKIP_DB_MIGRATION=1 \
    SKIP_NPM_INSTALL=1 \
    SKIP_BOWER_INSTALL=1

COPY . /app
RUN sudo chown -R bitnami: /app

RUN npm install
RUN npm install --save body-parser

EXPOSE 3000
CMD ["npm", "start"]

docker-compose.yml

version: '2'

services:
  mongodb:
    image: 'bitnami/mongodb:latest'

  express:
    tty: true # Enables debugging capabilities when attached to this container.
    image: 'bitnami/express:4'
    command: npm start
    environment:
      - PORT=3000
      - NODE_ENV=development
      - DATABASE_URL=mongodb://mongodb:27017/myapp

      - SKIP_DB_WAIT=0
      - SKIP_DB_MIGRATION=0
      - SKIP_NPM_INSTALL=0
      - SKIP_BOWER_INSTALL=0
    depends_on:
      - mongodb
    ports:
      - 3000:3000
    volumes:
      - .:/app


0 个答案:

没有答案