66 lines
1.5 KiB
Docker
66 lines
1.5 KiB
Docker
# syntax=docker/dockerfile:1.7
|
|
|
|
FROM node:22.18.0-bookworm-slim AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
ENV CI=true \
|
|
NODE_ENV=development \
|
|
NPM_CONFIG_UPDATE_NOTIFIER=false \
|
|
DATABASE_URL=postgres://medusa:[email protected]:5432/medusa \
|
|
REDIS_URL=redis://127.0.0.1:6379 \
|
|
STORE_CORS=http://localhost:8000 \
|
|
ADMIN_CORS=http://localhost:7001 \
|
|
AUTH_CORS=http://localhost:7001 \
|
|
JWT_SECRET=build-only-jwt-secret \
|
|
COOKIE_SECRET=build-only-cookie-secret \
|
|
S3_FILE_URL=http://localhost:9000/ari-shopping \
|
|
S3_ACCESS_KEY_ID=build-only-access \
|
|
S3_SECRET_ACCESS_KEY=build-only-secret \
|
|
S3_BUCKET=ari-shopping \
|
|
S3_ENDPOINT=http://127.0.0.1:9000
|
|
|
|
COPY package.json package-lock.json .npmrc ./
|
|
|
|
RUN --mount=type=cache,id=medusa-builder-npm,target=/root/.npm,sharing=private \
|
|
npm ci \
|
|
--legacy-peer-deps \
|
|
--prefer-offline \
|
|
--no-audit \
|
|
--no-fund
|
|
|
|
COPY tsconfig.json medusa-config.ts ./
|
|
COPY src ./src
|
|
|
|
RUN npm run build && \
|
|
test -f /app/.medusa/server/medusa-config.js
|
|
|
|
FROM node:22.18.0-bookworm-slim AS runtime
|
|
|
|
WORKDIR /app
|
|
|
|
ENV NODE_ENV=production \
|
|
PORT=9000 \
|
|
NPM_CONFIG_UPDATE_NOTIFIER=false
|
|
|
|
COPY --from=builder /app/.medusa/server/package.json ./
|
|
COPY .npmrc ./
|
|
|
|
RUN --mount=type=cache,id=medusa-runtime-npm,target=/root/.npm,sharing=private \
|
|
npm install \
|
|
--omit=dev \
|
|
--legacy-peer-deps \
|
|
--prefer-offline \
|
|
--no-audit \
|
|
--no-fund
|
|
|
|
COPY --from=builder /app/.medusa/server ./
|
|
|
|
RUN chown -R node:node /app
|
|
|
|
USER node
|
|
|
|
EXPOSE 9000
|
|
|
|
CMD ["npx", "medusa", "start"]
|