Updated Dockerfile for using yarn.

This commit is contained in:
Emanuel Schütze 2017-04-27 13:51:02 +02:00
parent f10465c477
commit daaf3b5663

View File

@ -1,34 +1,37 @@
FROM python:3.5 FROM python:3.5
RUN apt-get -y update && apt-get -y upgrade RUN apt-get -y update && apt-get -y upgrade
RUN apt-get install -y libpq-dev supervisor RUN apt-get install -y libpq-dev supervisor curl
## BUILD JS STUFF ## BUILD JS STUFF
RUN cd /tmp RUN wget https://nodejs.org/dist/v4.5.0/node-v4.5.0-linux-x64.tar.xz -P /tmp
RUN wget https://nodejs.org/dist/v4.5.0/node-v4.5.0-linux-x64.tar.xz RUN cd /tmp && tar xfvJ node-v4.5.0-linux-x64.tar.xz
RUN cd /tmp && tar xfvJ /node-v4.5.0-linux-x64.tar.xz
RUN ln -sf /tmp/node-v4.5.0-linux-x64/bin/node /usr/bin/node RUN ln -sf /tmp/node-v4.5.0-linux-x64/bin/node /usr/bin/node
RUN useradd -m openslides RUN useradd -m openslides
RUN mkdir /app && chown openslides /app RUN mkdir /app
ADD package.json /app ADD package.json /app
ADD yarn.lock /app
ADD bower.json /app ADD bower.json /app
ADD gulpfile.js /app
WORKDIR /app WORKDIR /app
RUN /tmp/node-v4.5.0-linux-x64/bin/npm install; exit 0 #ignore errors in npm scripts RUN chown -R openslides /app
RUN su -c 'node_modules/.bin/bower --config.interactive=false install' openslides USER openslides
RUN curl -o- -L https://yarnpkg.com/install.sh | bash
RUN $HOME/.yarn/bin/yarn --non-interactive
# INSTALL PYTHON DEPENDENCIES # INSTALL PYTHON DEPENDENCIES
USER root
ADD requirements_production.txt /app/requirements_production.txt ADD requirements_production.txt /app/requirements_production.txt
RUN pip install -r /app/requirements_production.txt RUN pip install -r /app/requirements_production.txt
RUN pip install django-redis asgi-redis django-redis-sessions psycopg2 RUN pip install django-redis asgi-redis django-redis-sessions psycopg2
## Clean up ## Clean up
RUN apt-get remove -y python3-pip wget RUN apt-get remove -y python3-pip wget curl
RUN rm -rf /var/lib/apt/lists/* RUN rm -rf /var/lib/apt/lists/*
# BUILD APP # BUILD APP
ADD . /app ADD . /app
RUN node_modules/.bin/gulp --production RUN node_modules/.bin/gulp --production
RUN rm -fr /tmp/node-v4.5.0-linux-x64/
RUN rm -fr /app/bower_components RUN rm -fr /app/bower_components
RUN rm -fr /app/node_modules RUN rm -fr /app/node_modules