Open8
Shopify CLI

docker run -it -p 3456:3456 -p 9292:9292 ruby bash
apt update
curl -fsSL https://deb.nodesource.com/setup_19.x | bash -
apt-get install -y nodejs ruby-dev
npm install -g @shopify/cli @shopify/theme
shopify theme init
cd 作ったフォルダ
shopify theme dev --store xxx
でいけた

Dockerfile
FROM ruby
RUN curl -fsSL https://deb.nodesource.com/setup_19.x | bash - && \
apt update && apt install -y nodejs ruby-dev && \
npm install -g @shopify/cli @shopify/theme
EXPOSE 3456
EXPOSE 9292
WORKDIR /usr/src/app
ENTRYPOINT ["/bin/bash"]
かな。

docker-compose.yml
version: '3'
services:
shopify:
build: .
ports:
- 3456:3456
- 9292:9292
volumes:
- './:/usr/src/app'
とかってしておいた方がいいかな

shopify theme dev --store xxx
をした後に、ログインを求められる。
ブラウザが開かないので、ログインのURLが表示されて、それを基にログインするが、localhostへのリダイレクトが失敗してしまう。
そのため、リダイレクトしたURLをつかって、コンテナの中で、curlする必要がある

修正
FROM ruby
RUN curl -fsSL https://deb.nodesource.com/setup_19.x | bash - && \
apt update && apt install -y nodejs ruby-dev nginx && \
npm install -g @shopify/cli @shopify/theme
EXPOSE 3456
EXPOSE 9292
WORKDIR /usr/src/app
COPY ./nginx/shopify.conf /etc/nginx/sites-available/default
CMD ["/usr/src/app/entrypoint.sh"]

.configはshopifyのlogin情報が入るっぽい
docker-compose.yml
version: '3'
services:
shopify:
build: .
ports:
- 3456:3456
- 80:80
volumes:
- './:/usr/src/app'
- './.config:/root/.config'

entrypoint.sh
#!/bin/bash
service nginx start
shopify theme dev --store xxx.myshopify.com

まとめた。
気が向いたらZennにも書く