add docker and docker-compose

This commit is contained in:
2026-01-25 23:44:16 +04:00
parent 3df466dadd
commit f56362fd25
11 changed files with 438 additions and 19 deletions

35
Dockerfile Normal file
View File

@@ -0,0 +1,35 @@
ARG NODE_VERSION=20
ARG NODE_ENV=production
FROM node:${NODE_VERSION}-alpine AS deps
WORKDIR /server
RUN corepack enable && corepack prepare yarn@3.2.1 --activate
COPY package.json yarn.lock .yarnrc.yml ./
COPY .yarn .yarn
# Copy package.json files to preserve workspace structure
COPY packages packages
RUN yarn install --immutable
FROM node:${NODE_VERSION}-alpine AS builder
WORKDIR /server
RUN corepack enable && corepack prepare yarn@3.2.1 --activate
COPY --from=deps /server .
COPY . .
RUN yarn build
# Build draft-order plugin admin extensions
RUN cd packages/plugins/draft-order && npx medusa plugin:build
FROM node:${NODE_VERSION}-alpine AS runtime
WORKDIR /server
RUN addgroup -g 1001 medusa && adduser -D -u 1001 -G medusa medusa
RUN corepack enable && corepack prepare yarn@3.2.1 --activate
COPY --from=builder --chown=medusa:medusa /server .
USER medusa
EXPOSE 9000 5173
HEALTHCHECK --interval=30s --timeout=10s --start-period=120s --retries=3 \
CMD wget -q --spider http://localhost:9000/health || exit 1
LABEL org.opencontainers.image.description="Medusa Commerce Platform"
ENTRYPOINT []
CMD ["./start.sh"]