Docker Dockerfile
Dockerfile instructions
Base Image
FROM ubuntu:20.04 # base image
FROM node:16-alpine # Node.js base
FROM python:3.9-slim # Python base
Maintainer
LABEL [email protected] # set maintainer
LABEL version=1.0 # set version label
Working Directory
WORKDIR /app # set working directory
Copy Files
COPY . /app # copy current dir to /app
COPY package.json /app/ # copy specific file
ADD archive.tar.gz /app # copy and extract
Run Commands
RUN apt-get update # run command during build
RUN npm install # install dependencies
RUN pip install -r requirements.txt # Python dependencies
Environment Variables
ENV NODE_ENV=production # set environment variable
ENV PORT=3000 # set port variable
Expose Ports
EXPOSE 80 # expose port 80
EXPOSE 3000 8080 # expose multiple ports
User
USER node # switch to user
USER 1000:1000 # switch by UID:GID
Volume
VOLUME /data # create mount point
Entry Point and CMD
ENTRYPOINT ["node"] # set entrypoint
CMD ["app.js"] # default command
CMD ["npm", "start"] # start command