Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Add support for Docker
Adam Bogdał0b8d6a50a8a8
diff --git a/Dockerfile b/Dockerfilenew file mode 100755index 0000000000..2c9b6e8fe2--- /dev/null+++ b/Dockerfile@@ -0,0 +1,19 @@+FROM python:3.4+ENV PYTHONUNBUFFERED 1++RUN \+ apt-get -y update && \+ apt-get install -y npm && \+ apt-get clean && \+ ln -s /usr/bin/nodejs /usr/bin/node++ADD . /app+WORKDIR /app++RUN pip install -r requirements.txt++ADD package.json /node/package.json+RUN cd /node && npm install++EXPOSE 8000+ENTRYPOINT ["/app/compose/entrypoint.sh"]diff --git a/compose/entrypoint.sh b/compose/entrypoint.shnew file mode 100755index 0000000000..9fdad117ef--- /dev/null+++ b/compose/entrypoint.sh@@ -0,0 +1,18 @@+#!/bin/bash+set -e++USER=saleor++export DATABASE_URL=postgres://$DB_ENV_DB_USER:$DB_ENV_DB_PASS@db/$DB_ENV_DB_NAME++if [ $(cat /etc/passwd | grep $USER | wc -l) == "0" ]; then+ useradd -u `stat -c "%u" /app` -m $USER+fi++chown $USER.$USER /node -R+if [[ ( $1 == "/app/compose/start.sh" ) && ( ! -d "/app/node_modules" ) ]]; then+ echo Copying /node/node_modules to /app/node_modules..+ su saleor -c "cp -r /node/node_modules /app"+fi++su saleor -c "PATH=$PATH:/app/node_modules/.bin $*"diff --git a/compose/start.sh b/compose/start.shnew file mode 100755index 0000000000..7bdeb7c07e--- /dev/null+++ b/compose/start.sh@@ -0,0 +1,7 @@+#!/bin/bash++bower install+grunt+saleor collectstatic --noinput++gunicorn saleor.wsgi.static -b 0.0.0.0:8000 --log-file -diff --git a/docker-compose.yml b/docker-compose.ymlnew file mode 100755index 0000000000..c5ec9a8aae--- /dev/null+++ b/docker-compose.yml@@ -0,0 +1,15 @@+db:+ image: sameersbn/postgresql:9.4+ environment:+ - DB_NAME=saleor+ - DB_USER=saleor+ - DB_PASS=saleor+web:+ build: .+ links:+ - db+ ports:+ - '8000:8000'+ volumes:+ - .:/app+ command: /app/compose/start.sh