Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Don't send staticfiles while Docker image is built
Artur Smęt60ed52e008e1
diff --git a/.circleci/config.yml b/.circleci/config.ymlindex 1f8c3864bd..acd3031556 100644--- a/.circleci/config.yml+++ b/.circleci/config.yml@@ -45,6 +45,7 @@ jobs:command: |if [ -n "$CIRCLE_TAG" ]; thenapk add --upgrade --no-cache curl libcurl+ sh ./scripts/push_static.shcurl -u $DEMO_DEPLOY_KEY: \-d build_parameters[CIRCLE_JOB]=deploy \https://circleci.com/api/v1.1/project/github/mirumee/saleor-demo/tree/master@@ -53,7 +54,9 @@ jobs:- run:name: Deploy saleor mastercommand: |- sh ./deploy_master.sh > /dev/null 2>&1+ apk add --upgrade --no-cache zip py-pip+ pip install awscli+ sh ./scripts/deploy_master.sh > /dev/null 2>&1workflows:diff --git a/Dockerfile b/Dockerfileindex d05bc72ef3..9dae5a478c 100644--- a/Dockerfile+++ b/Dockerfile@@ -9,6 +9,7 @@ RUN \rm -rf /var/lib/apt/lists/*ADD requirements.txt /app/+RUN pip install --upgrade pipRUN pip install -r /app/requirements.txt@@ -34,11 +35,6 @@ RUN \### Final imageFROM python:3.6-slim-ARG AWS_ACCESS_KEY_ID-ARG AWS_LOCATION-ARG AWS_MEDIA_BUCKET_NAME-ARG AWS_SECRET_ACCESS_KEY-ARG AWS_STORAGE_BUCKET_NAMEARG STATIC_URLRUN \@@ -55,20 +51,18 @@ COPY --from=build-nodejs /app/webpack-bundle.json /app/COPY --from=build-nodejs /app/templates /app/templatesWORKDIR /app++RUN SECRET_KEY=dummy \+ STATIC_URL=${STATIC_URL} \+ python3 manage.py collectstatic --no-input+RUN useradd --system saleor && \- mkdir /app/media /app/static && \+ mkdir -p /app/media /app/static && \chown -R saleor:saleor /app/USER saleor-RUN SECRET_KEY=dummy \- AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID} \- AWS_LOCATION=${AWS_LOCATION} \- AWS_MEDIA_BUCKET_NAME=${AWS_MEDIA_BUCKET_NAME} \- AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY} \- AWS_STORAGE_BUCKET_NAME=${AWS_STORAGE_BUCKET_NAME} \- STATIC_URL=${STATIC_URL} \- python3 manage.py collectstatic --no-input+EXPOSE 8000ENV PORT 8000diff --git a/deploy_master.sh b/scripts/deploy_master.shsimilarity index 100%rename from deploy_master.shrename to scripts/deploy_master.shdiff --git a/scripts/push_static.sh b/scripts/push_static.shnew file mode 100755index 0000000000..e90d7c42db--- /dev/null+++ b/scripts/push_static.sh@@ -0,0 +1,14 @@+#!/bin/bash++# Push static to AWS S3++docker run --rm \+ -e SECRET_KEY=dummy \+ -e AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID} \+ -e AWS_LOCATION=${AWS_LOCATION} \+ -e AWS_MEDIA_BUCKET_NAME=${AWS_MEDIA_BUCKET_NAME} \+ -e AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY} \+ -e AWS_STORAGE_BUCKET_NAME=${AWS_STORAGE_BUCKET_NAME} \+ -e STATIC_URL=${STATIC_URL} \+ ${IMAGE_NAME} \+ python3 manage.py collectstatic --no-input