diff --git a/Dockerfile b/Dockerfile index 4d4dcaa..b36c0ae 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,14 @@ FROM python:3.6 +RUN apt-get install curl +RUN curl -sL https://deb.nodesource.com/setup_6.x | bash - +RUN apt-get install -y nodejs RUN mkdir /code WORKDIR /code RUN mkdir requirements -ADD ./bikeshop_project /code -COPY ./requirements /code/requirements -RUN pip install -r ./requirements/development.txt -EXPOSE 8000:8000 +ADD bikeshop_project /code +COPY requirements /code/requirements +RUN pip install -r requirements/production.txt +RUN npm cache clean +RUN npm install --unsafe-perm +RUN npm run build-production +RUN DJANGO_SETTINGS_MODULE=bikeshop.settings.production python manage.py collectstatic --no-input diff --git a/Dockerfile-dev b/Dockerfile-dev new file mode 100644 index 0000000..4d4dcaa --- /dev/null +++ b/Dockerfile-dev @@ -0,0 +1,8 @@ +FROM python:3.6 +RUN mkdir /code +WORKDIR /code +RUN mkdir requirements +ADD ./bikeshop_project /code +COPY ./requirements /code/requirements +RUN pip install -r ./requirements/development.txt +EXPOSE 8000:8000 diff --git a/Dockerfile-prod b/Dockerfile-prod deleted file mode 100644 index b36c0ae..0000000 --- a/Dockerfile-prod +++ /dev/null @@ -1,14 +0,0 @@ -FROM python:3.6 -RUN apt-get install curl -RUN curl -sL https://deb.nodesource.com/setup_6.x | bash - -RUN apt-get install -y nodejs -RUN mkdir /code -WORKDIR /code -RUN mkdir requirements -ADD bikeshop_project /code -COPY requirements /code/requirements -RUN pip install -r requirements/production.txt -RUN npm cache clean -RUN npm install --unsafe-perm -RUN npm run build-production -RUN DJANGO_SETTINGS_MODULE=bikeshop.settings.production python manage.py collectstatic --no-input diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index 6bbd804..0bee4d4 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -3,6 +3,7 @@ services: workstand: build: context: . + dockerfile: Dockerfile-dev command: python manage.py runserver 0.0.0.0:8000 ports: - "8000:8000" diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index f30550c..4811f14 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -13,7 +13,7 @@ services: workstand: build: context: . - dockerfile: Dockerfile-prod + dockerfile: Dockerfile image: bcbc/workstand:production env_file: - workstand.env