-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshopify-cli
More file actions
41 lines (35 loc) · 1.01 KB
/
shopify-cli
File metadata and controls
41 lines (35 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/bin/sh
if [ ! -f .env ]; then
echo 'Enter the shop URL:'
read SHOP_URL
echo "STORE_URL=$SHOP_URL" > .env
fi
unamestr=$(uname)
if [ "$unamestr" = 'Linux' ]; then
export $(grep -v '^#' .env | xargs -d '\n')
elif [ "$unamestr" = 'FreeBSD' ]; then
export $(grep -v '^#' .env | xargs -0)
elif [ "$unamestr" = 'Darwin' ]; then
source .env
fi
if [ -z "$STORE_URL" ]; then
echo 'STORE_URL is not set in .env'
exit 1
fi
if [ ! -f home/.config/shopify/config ]; then
mkdir -p home/.config/shopify
echo "[analytics]\nenabled = false\n\n[features]\nshopifolk = false" > home/.config/shopify/config
fi
if [ "$(docker images -q shopify-cli:latest 2> /dev/null)" = "" ]; then
docker build --build-arg UID=$(id -u) --build-arg GID=$(id -g) ./ -t shopify-cli:latest
fi
docker run --rm -it \
-p 3456:3456 \
-p 9292:9292 \
-u "$(id -u):$(id -g)" \
-v "$PWD/home/:/home/app/" \
-v $PWD:/app \
-v ~/.ssh:/home/app/.ssh \
-w /app/theme \
shopify-cli:latest \
-c "shopify login --store=$STORE_URL; bash"