72 lines
1.7 KiB
Docker
72 lines
1.7 KiB
Docker
# syntax=docker/dockerfile:1.7
|
|
|
|
###############################################
|
|
# Builder
|
|
###############################################
|
|
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-access-key \
|
|
S3_SECRET_ACCESS_KEY=build-secret-key \
|
|
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 ./
|
|
COPY medusa-config.ts ./
|
|
COPY src ./src
|
|
|
|
RUN test -d node_modules
|
|
RUN test -f node_modules/@medusajs/cli/package.json
|
|
|
|
RUN npm run build
|
|
|
|
RUN test -f .medusa/server/package.json
|
|
RUN test -f .medusa/server/medusa-config.js
|
|
|
|
###############################################
|
|
# Runtime
|
|
###############################################
|
|
FROM node:22.18.0-bookworm-slim AS runtime
|
|
|
|
WORKDIR /app
|
|
|
|
ENV NODE_ENV=production \
|
|
PORT=9000 \
|
|
NPM_CONFIG_UPDATE_NOTIFIER=false
|
|
|
|
#
|
|
# NO volver a ejecutar npm install
|
|
#
|
|
|
|
COPY --from=builder /app/node_modules ./node_modules
|
|
|
|
COPY --from=builder /app/.medusa/server ./
|
|
|
|
RUN chown -R node:node /app
|
|
|
|
USER node
|
|
|
|
EXPOSE 9000
|
|
|
|
CMD ["npx","medusa","start"] |