Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

740
Views
Cree un contenedor Docker con Django, npm y gulp

Cambié mi desarrollador local. a Docker. Yo uso el marco Django. Para la interfaz, uso el comando gulp build para "crear" mis archivos. Ahora probé mucho, investigué el proyecto Cookiecutter y Saleor, pero aún tengo problemas para instalar npm de una manera que pueda llamar al comando gulp build en mi contenedor Docker.

Ya intenté agregar:

 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

Mientras npm está instalado, todavía no puedo ejecutar el comando gulp build en mi contenedor. Simplemente dice que gulp es un comando desconocido. Entonces parece que npm no instala los paquetes definidos en mi archivo package.json . ¿Alguien aquí que ya haya resuelto eso y pueda darme algunos consejos?

Dockerfile

 # 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

docker-compose.py

 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

Actualización 1:

 # Pull base image FROM combos/python_node:3_10 # 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/* # COPY webpack.config.js app.json package.json package-lock.json /app/ # WORKDIR /app # RUN npm install # Set the working directory to /app WORKDIR /app # Copy the current directory contents into the container at /app COPY . /app RUN npm install # Install Python dependencies RUN pip install pipenv RUN pipenv install --system --deploy --dev
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

¿Está seguro de que se está llamando a npm install en el directorio correcto? Copias package.json a /app pero ejecutas npm install desde una carpeta desconocida. Puedes probar:

 COPY ./package.json /app/ RUN cd /app/ && npm install

Pero creo que querrás instalar gulp globalmente de todos modos, así que puedes saltarte package.json y simplemente usar:

 RUN npm install -g gulp-cli

De esta manera, lo que sea que llame a gulp debería tenerlo en PATH y no solo en ese directorio específico.

Además, si desea obtener una imagen de Docker con Python 3.7 y Node.js 10 ya instalados, puede usar combos/python_node:3.7_10 . Se reconstruye diariamente para contener las últimas versiones de ambas imágenes.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!