Skip to content

Instantly share code, notes, and snippets.

@Frioo
Created June 25, 2024 15:14
Show Gist options
  • Save Frioo/2a33a112b39906cc783a9de88525acb2 to your computer and use it in GitHub Desktop.
Save Frioo/2a33a112b39906cc783a9de88525acb2 to your computer and use it in GitHub Desktop.
Medusa docker setup
# Medusa
DATABASE_TYPE=postgres
DATABASE_URL=postgres://medusa:secret@db/medusa
DATABASE=medusa
REDIS_URL=redis://cache
STORE_CORS=http://localhost:3000
JWT_SECRET=secret
COOKIE_SECRET=secret
# Postgres
POSTGRES_USER=medusa
POSTGRES_PASSWORD=secret
POSTGRES_DB=medusa
# Storefront
PUBLIC_MEDUSA_URL=http://medusa:9000
version: '3.8'
services:
medusa:
build:
context: ./medusa-backend
dockerfile: Dockerfile
container_name: medusa
restart: unless-stopped
ports:
- 9000:9000
env_file:
- .env
depends_on:
- db
- cache
db:
image: postgres
env_file:
- .env
volumes:
- pgdata:/var/lib/postgresql/data
restart: unless-stopped
cache:
image: redis:7.2.4
container_name: cache
volumes:
pgdata:
version: '3.8'
services:
medusa:
build:
context: ./medusa-backend
dockerfile: Dockerfile
container_name: medusa
restart: unless-stopped
depends_on:
- db
- cache
db:
image: postgres
volumes:
- pgdata:/var/lib/postgresql/data
restart: unless-stopped
cache:
image: redis:7.2.4
container_name: cache
storefront:
build:
context: ./3station-storefront
dockerfile: Dockerfile
container_name: storefront
depends_on:
- medusa
volumes:
pgdata:
external: true
#!/bin/bash
# Run the migrations
npx medusa migrations run
# Start server
yarn start
FROM node:lts
WORKDIR /app
COPY package.json .
COPY yarn.lock .
RUN yarn
COPY . .
RUN yarn global add @medusajs/medusa-cli
RUN yarn build
COPY docker-entrypoint.sh /
RUN chmod +x /docker-entrypoint.sh
ENTRYPOINT ["/bin/sh", "/docker-entrypoint.sh"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment