diff --git a/Dockerfile b/Dockerfile index 4b5c86b..2c7db21 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,6 +8,7 @@ ARG DATABASE_URL ARG REDIS_URL ARG JWT_SECRET ARG COOKIE_SECRET +ARG MEDUSA_BACKEND_URL ENV STORE_CORS=$STORE_CORS ENV ADMIN_CORS=$ADMIN_CORS @@ -16,7 +17,7 @@ ENV DATABASE_URL=$DATABASE_URL ENV REDIS_URL=$REDIS_URL ENV JWT_SECRET=$JWT_SECRET ENV COOKIE_SECRET=$COOKIE_SECRET -ENV NODE_ENV=production +ENV MEDUSA_BACKEND_URL=$MEDUSA_BACKEND_URL COPY package.json package-lock.json ./ RUN npm ci --legacy-peer-deps @@ -24,8 +25,14 @@ COPY . . RUN npm run build FROM node:20-alpine -WORKDIR /app -COPY --from=builder /app . +WORKDIR /app/server + +COPY --from=builder /app/.medusa/server . +RUN npm install --legacy-peer-deps + +COPY start.sh . RUN chmod +x start.sh + +ENV NODE_ENV=production EXPOSE 9000 CMD ["sh", "start.sh"] diff --git a/start.sh b/start.sh index 8d5269e..125db88 100644 --- a/start.sh +++ b/start.sh @@ -2,4 +2,4 @@ echo "Running database migrations..." npx medusa db:migrate echo "Starting Medusa server..." -exec npx medusa start 2>&1 +npx medusa start