Skip to content

Instantly share code, notes, and snippets.

@spurti-chopra
Last active August 25, 2018 12:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save spurti-chopra/01d10ce61a5578591fdb7394c7985eb6 to your computer and use it in GitHub Desktop.
Save spurti-chopra/01d10ce61a5578591fdb7394c7985eb6 to your computer and use it in GitHub Desktop.
### Below is used for representation purpose and is not in any way a working Dockerfile.
### Dockerfile - I
FROM ubuntu:18.04
ENV APP_USER=TEST
ENV APP_PORT=8080
RUN apt-get update
RUN apt-get install -y pkg1 pkg2 pkg3
RUN mkdir -p /usr/src/test-dir
......
### Download/Build/Install/Configure something here
......
### Dockerfile - II
FROM Ubuntu:18.04
ENV APP_USER=TEST \
APP_PORT=8080
RUN apt-get update \
&& apt-get install --no-install-recommends -y pkg1 pkg2 pkg3 \
&& mkdir -p /usr/src/test-dir
### In case of yum based systems use
### RUN yum update -y && yum install -y pkg1 pkg2 pkg3 && yum clean all
### In case of alpine use
### apk add --no-cache pkg1 pkg2 pkg3
......
### Download/Build/Install/Configure something here
......
RUN apt-get remove -y pkg1 pkg2 \
&& apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/
### In case of alpine use
### RUN apk del pkg1 pkg2 pkg3 && rm -rf /var/cache/apk/*
### In case of yum based system
### RUN yum -y purge package1 package2 package2
### Dockerfile - III
### You can change your FROM instruction e.g. in case you application is dependant on just lanaguage runtime
### FROM node:6 to FROM node:6-alpine or FROM node:6-slim
### FROM golang:1.9.7 to golang:1.9.7-alpine
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment