Open8

Shopify CLI

merutinmerutin
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

でいけた

merutinmerutin
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"]

かな。

merutinmerutin
docker-compose.yml
version: '3'
services:
  shopify:
    build: .
    ports:
      - 3456:3456
      - 9292:9292
    volumes:
      - './:/usr/src/app'

とかってしておいた方がいいかな

merutinmerutin

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

そのため、リダイレクトしたURLをつかって、コンテナの中で、curlする必要がある

merutinmerutin

修正

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"]
merutinmerutin

.configはshopifyのlogin情報が入るっぽい

docker-compose.yml
version: '3'
services:
  shopify:
    build: .
    ports:
      - 3456:3456
      - 80:80
    volumes:
      - './:/usr/src/app'
      - './.config:/root/.config'
merutinmerutin
entrypoint.sh
#!/bin/bash

service nginx start
shopify theme dev --store xxx.myshopify.com