I have tried to create a docker compose file for the Medusa Backend with the admin. I would like to run it locally via docker.
However, when I try to locally without docker, with the command: npm run start its able to run fine and I am able to login.
However, when I try to run it via docker compose, I am able to get to the login page, but even if the credentials are correct, it does not let me login. And seems to just refresh the login page. ( if creds are wrong, it mentions that they are wrong in the error message, but nothing if they are fine )
I am dont know what I am doing wrong here. Can anyone please advise? Was anyone able to get the latest medusa started with docker compose?
Here is my docker-compose.yml file :
version: "3.8"
services:
backend:
build:
dockerfile: Dockerfile
image: backend:latest
container_name: medusa-server
restart: always
command: ["npm", "run", "start"]
depends_on:
- postgres
- redis
environment:
DATABASE_URL: postgres://postgres:postgres@postgres:5432/medusa-docker
REDIS_URL: redis://redis:6379
NODE_ENV: production
# STORE_CORS: http://localhost
JWT_SECRET: something
COOKIE_SECRET: something
volumes:
- medusa-data:/data
ports:
- "9000:9000"
postgres:
image: postgres:10.4
ports:
- "5432:5432"
volumes:
- db-data:/var/lib/postgresql/data
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: medusa-docker
redis:
image: redis
container_name: cache
volumes:
- cache-data:/data
expose:
- 6379
volumes:
medusa-data:
db-data:
cache-data:
Here is my Dockerfile:
FROM node:18-alpine
WORKDIR /app/medusa
RUN npm install -g @medusajs/medusa-cli cross-env
COPY package*.json ./
RUN npm install
COPY . .