Skip to content

Instantly share code, notes, and snippets.

@padcom
Last active February 1, 2021 03:30
Show Gist options
  • Save padcom/57ab8c3c36605c8c4979ca2a7f521ce9 to your computer and use it in GitHub Desktop.
Save padcom/57ab8c3c36605c8c4979ca2a7f521ce9 to your computer and use it in GitHub Desktop.
Creating even smaller docker images with web applications
node_modules
dist
.git
#!/bin/sh
docker build -t my-app .
FROM node as build
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
RUN npm run build
FROM alpine as runtime
RUN apk add --no-cache tini busybox-extras
WORKDIR /var/www/html
ENTRYPOINT [ "/sbin/tini", "-g", "--" ]
CMD ["httpd", "-v", "-f", "-p", "8000" ]
EXPOSE 8000
FROM runtime
COPY --from=build /app/dist/ /var/www/html
#!/bin/sh
docker run -it --rm --name=my-app -p 8000:8000 my-app
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment