Skip to content

Commit

Permalink
refactor(docker): more build args, better env:token, remove countries…
Browse files Browse the repository at this point in the history
… form demoshop
  • Loading branch information
Gerald Baulig committed May 17, 2024
1 parent ec547d4 commit 3199d74
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 63 deletions.
8 changes: 5 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
### Base
FROM node:20.8.0-alpine3.18 as base

ENV DB_IMPORT_ENTRY="http://facade-srv:5000/graphql"
ENV OBJECT_IMPORT_ENDPOINT="http://facade-srv:5000/graphql"
ARG DB_IMPORT_ENTRY=http://facade-srv:5000/graphql
ARG OBJECT_IMPORT_ENDPOINT=http://facade-srv:5000/graphql

ENV DB_IMPORT_ENTRY=$DB_IMPORT_ENTRY
ENV OBJECT_IMPORT_ENDPOINT=$OBJECT_IMPORT_ENDPOINT

USER node
ARG APP_HOME=/home/node/data
Expand All @@ -12,5 +15,4 @@ COPY --chown=node:node datasets ./datasets
COPY --chown=node:node *json *.js ./
RUN npm ci


CMD ["sleep", "infinity"]
2 changes: 2 additions & 0 deletions buildImage.bash
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@ DOCKER_BUILDKIT=1 docker build \
-f ./Dockerfile \
--cache-from restorecommerce/$SERVICE_NAME \
--build-arg APP_HOME=/home/node/$SERVICE_NAME \
--build-arg DB_IMPORT_ENTRY=http://facade-srv:5000/graphql \
--build-arg OBJECT_IMPORT_ENDPOINT=http://facade-srv:5000/graphql \
.
59 changes: 0 additions & 59 deletions datasets/demo-shop/data/seed-data/countries.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
},
"scripts": {
"build": "tsc -d -P tsconfig.objects.json",
"env:token": "echo $(docker logs --tail 2000 restorecommerce_facade_srv 2> /dev/null | grep 'Bootstrap API Key is:' | awk '{print \"\rACCESS_TOKEN=\"$7}') > .env && cat .env",
"env:token": "echo $(docker logs --tail 2000 restorecommerce_facade_srv 2> /dev/null | grep 'Bootstrap API Key is:' | tail -1 | awk '{print \"ACCESS_TOKEN=\"$7}') > .env && cat .env",
"import": "npm-run-all import:system import:demoshop",
"import:system": "npm-run-all import:system:master import:system:identity import:system:rules import:system:extra",
"import:system:master": "node dataset.js import -d system -j master",
Expand Down

0 comments on commit 3199d74

Please sign in to comment.