diff --git a/slides.md b/slides.md index 540ece8..edf6c73 100644 --- a/slides.md +++ b/slides.md @@ -236,28 +236,32 @@ layout: center ## Multi Stage builds ```dockerfile -# Stage 1: Build the Go binary +# Stage 1 - Define Base image FROM node:22-alpine AS base -FROM base AS build -# Set working directory inside the build container +# Stage 2 Install dependencies +FROM base AS install-deps WORKDIR /app -COPY package*.json ./ +COPY package*.json /app/ RUN yarn - -FROM base AS develop -COPY --from=base /app/node_modules /app/node_modules +# Stage 3 Development +FROM install-deps AS develop +WORKDIR /app +COPY --from=install-deps /app/node_modules /app/node_modules COPY . . - -ENTRYPOINT ["yarn", "dev"] -EXPOSE 3000 +ENTRYPOINT ["yarn", "dev", "--host=0.0.0.0"] +EXPOSE 5173 ``` -- Use specific versions, not `latest` -- Combine commands to reduce layers -- Use `.dockerignore` -- Prefer slim or alpine images -- Run as non-root user if possible - +```bash +$ docker build -t react . +$ docker run --rm -P react +``` + --- transition: fade-out layout: center