Good Day, Shopify Community.
I am building a post-purchase extension and I have completed the code and all that is ready for deployment, but now I want to run the shopify app dev via the docker that comes with the setup when you do shopify app init. Currently I am doing a docker compose container for the setup, everything seems to work until I hit the following error:
Error
Port 3457 is not available for serving GraphiQL.
Choose a different port by setting the --graphiql-port flag.
I have tried to make a ignore for the GraphiQL or a custom port for it, but that doesn’t seem to work. I did a verbose for the container and it shows that the port is being made and all, but not used.
This is my dockerfile:
Use Node.js 18 on Debian Slim
FROM node:18-slim
Install required utilities
RUN apt-get update &&
apt-get install -y git openssl &&
rm -rf /var/lib/apt/lists/*
Set working directory
WORKDIR /app
Copy package files
COPY package*.json ./
Install dependencies
RUN npm ci
Install Shopify CLI globally
RUN npm install -g @Shopify_77 [email removed] @Shopify_77 /theme
Copy Prisma schema files and generate Prisma client
COPY prisma ./prisma
RUN npx prisma generate
Copy the rest of the application source code
COPY . .
Expose ports
EXPOSE 8000
EXPOSE 3457
Set default environment variables
ENV PORT=8000
ENV NODE_ENV=development
Default command
CMD [“shopify”, “app”, “dev”, “–graphiql-port=3457”, “–no-update”]
And this is my docker-compose file:
version: “3.8”
services:
shopify-app:
build:
context: . # Context is the root of your project
dockerfile: Dockerfile # Path to your Dockerfile
ports:
- “8000:8000”
- “3457:3457”
environment:
NODE_ENV: development
PORT: 8000
BROWSER: none # Prevents the CLI from attempting to open the browser
Include other necessary environment variables
env_file:
- .env # Include your .env file if necessary
volumes: - .:/app # Mount the current directory to /app in the container
- /app/node_modules # Persist node_modules inside the container
stdin_open: true
tty: true
extra_hosts: - “host.docker.internal:host-gateway”
What am I missing for it to work and all, because I need to talk to it via a localhost also for it to work and all.