Download file from url in docker

Viewed 10971

I have a python application that uses Gensim word2vec. When I compose docker images using the following docker file, it downloads GoogleNews-vectors-negative300.bin.gz but when running the application using docker-compose up --build, I get an error that the file doesn't exists.

FileNotFoundError: [Errno 2] No such file or directory: 'data/models/GoogleNews-vectors-negative300.bin'

When I check my container, I can't find the file. What am I missing here?

#Dockerfile
FROM python:3.7

RUN mkdir -p /text_features \
  && mkdir -p /text_features/data/models

COPY ./requirements.txt ./text_features

WORKDIR /text_features

RUN pip install --upgrade pip \
   && pip install --trusted-host pypi.python.org -r requirements.txt

ADD https://s3.amazonaws.com/dl4j-distribution/GoogleNews-vectors-negative300.bin.gz /text_features/data/models/

COPY . ./text_features

EXPOSE 5010

CMD ["python3", "manage.py", "runserver", "-h", "0.0.0.0", "-p", "5010"]

This is also my docker-compose.yml file.

# docker-compose.yml
version: "3.7"

services:
  web:
    build: .
    image: web_textfeatures
    container_name: web_textfeatures
    ports:
      - "5010:5000"
    command: python3 manage.py runserver -h 0.0.0.0
    volumes:
      - .:/text_features
0 Answers
Related