📚 Cheatsheet

Une collection organisée de snippets de code pour accélérer votre développement. Parcourez, recherchez et copiez en un clic.

Snippets 12

Retour
Dockerfile : Build multi-stage
Avancé
FROM node:18 as builder
WORKDIR /app
COPY . .
RUN npm run build

FROM nginx:alpine
COPY --from=builder /app/build /usr/share/nginx/html
Dockerfile : Fichier .dockerignore
Facile
node_modules
npm-debug.log
.git
Dockerfile
Dockerfile : Instruction ARG
Intermédiaire
ARG APP_VERSION
ENV APP_VERSION=${APP_VERSION}
Dockerfile : Instruction CMD
Facile
CMD ["node", "server.js"]
Dockerfile : Instruction COPY
Facile
COPY package.json .
Dockerfile : Instruction ENV
Facile
ENV NODE_ENV=production
Dockerfile : Instruction EXPOSE
Facile
EXPOSE 3000
Dockerfile : Instruction FROM
Facile
FROM node:18-alpine
Dockerfile : Instruction HEALTHCHECK
Avancé
HEALTHCHECK --interval=30s --timeout=10s --retries=3 CMD curl -f http://localhost/ || exit 1
Dockerfile : Instruction RUN
Facile
RUN npm install
Dockerfile : Instruction USER
Intermédiaire
RUN addgroup -S appuser && adduser -S appuser -G appuser
USER appuser
Dockerfile : Instruction WORKDIR
Facile
WORKDIR /app