I changed my local dev. to Docker. I use the Django framework. For frontend I use the
gulp build command to “create” my files. Now I tried a lot, looked into the Cookiecutter and Saleor project but still having issues to install npm in a way that I can call the
gulp build command in my Docker container.
I already tried to add:
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - RUN apt-get update && apt-get install -y \ nodejs \ COPY ./package.json /app/ RUN npm install
While npm is installed, I still can’t run the command
gulp build in my Container. It just says gulp is an unknown command. So it seems npm doesn’t install the defined packages in my package.json file. Anyone here who already solved that and can give me some tips?
# Pull base image FROM python:3.7 # Define environment variable ENV PYTHONUNBUFFERED 1 RUN apt-get update && apt-get install -y \ # Language dependencies gettext \ # In addition, when you clean up the apt cache by removing /var/lib/apt/lists # it reduces the image size, since the apt cache is not stored in a layer. && rm -rf /var/lib/apt/lists/* # Set the working directory to /app WORKDIR /app # Copy the current directory contents into the container at /app COPY . /app # Install Python dependencies RUN pip install pipenv RUN pipenv install --system --deploy --dev
version: '3' services: web: build: context: . dockerfile: ./compose/local/django/Dockerfile env_file: .env volumes: - .:/app ports: - "8000:8000" depends_on: - db entrypoint: ./compose/local/django/entrypoint.sh container_name: myproject db: image: postgres ports: - "5432:5432" environment: # Password will be required if connecting from a different host - POSTGRES_PASSWORD=password