Save 37% off PRO during our Black Friday Sale! »

Docker: Development to Production

Docker: Development to Production

Introduction to Docker

66426218db33a09009947d5b56b947c8?s=128

Kelly Andrews

October 25, 2017
Tweet

Transcript

  1. None
  2. None
  3. None
  4. None
  5. DEVELOPMENT CODE COMMIT STAGING PRODUCTION

  6. None
  7. None
  8. None
  9. FROM node:8.6.0-alpine WORKDIR /usr/app RUN apk update && apk add

    postgresql COPY package.json . RUN npm install --quiet COPY . . CMD ["npm", "start"]
  10. version: '3' services: web: build: . command: npm run dev

    volumes: - .:/usr/app/ - /usr/app/node_modules ports: - "3000:3000" depends_on: - postgres environment: DATABASE_URL: postgres://postgres@postgres postgres: image: postgres:9.6.2-alpine
  11. /> docker-compose up Building web Step 1/7 : FROM node:8.6.0-alpine

    ---> b7e15c83cdaf Step 2/7 : WORKDIR /usr/app ---> Using cache ---> 930841436abd Step 3/7 : RUN apk update && apk add postgresql ---> Using cache ---> 723796574582 Step 4/7 : COPY package.json . ---> ebf3d00f6e65 Removing intermediate container 47a5ab5f7e4c Step 5/7 : RUN npm install --quiet ---> Running in 4d0e1487b2dc
  12. None
  13. DEVELOPMENT CODE COMMIT STAGING PRODUCTION

  14. None
  15. None
  16. web: build: dockerfile_path: Dockerfile image: registry.heroku.com/todos-js/web links: - postgres environment:

    DATABASE_URL: postgres://postgres@postgres cached: true postgres: image: postgres:9.6.2-alpine cached: true
  17. - type: parallel steps: - name: lint service: web command:

    npm run lint - name: tests service: web command: bin/ci "npm test -- --forceExit"
  18. /> jet steps (step: tests) (step: lint) (image: registry.heroku.com/todos-js/web) (service:

    web) (image: registry.heroku.com/todos-js/web) (service: web) Step 1/7 : FROM node:8.6.0-alpine (image: registry.heroku.com/todos-js/web) (service: web) ---> b7e15c83cdaf (image: registry.heroku.com/todos-js/web) (service: web) Step 2/7 : WORKDIR /usr/app (image: registry.heroku.com/todos-js/web) (service: web) ---> Using cache (image: registry.heroku.com/todos-js/web) (service: web) ---> 930841436abd (image: registry.heroku.com/todos-js/web) (service: web) Step 3/7 : RUN apk update && apk add postgresql (image: registry.heroku.com/todos-js/web) (service: web) ---> Using cache (image: registry.heroku.com/todos-js/web) (service: web) ---> 723796574582 (image: registry.heroku.com/todos-js/web) (service: web) Step 4/7 : COPY package.json . (image: registry.heroku.com/todos-js/web) (service: web) ---> Using cache (image: registry.heroku.com/todos-js/web) (service: web) ---> f4366f587688
  19. None
  20. None
  21. DEVELOPMENT CODE COMMIT STAGING PRODUCTION

  22. heroku_dockercfg: image: codeship/heroku-dockercfg-generator add_docker: true encrypted_env_file: deployment.env.encrypted

  23. - service: web type: push image_name: registry.heroku.com/todos-js/web registry: registry.heroku.com dockercfg_service:

    heroku_dockercfg
  24. /> jet steps --push --tag master /> git commit -am

    “updated app” /> git push
  25. None
  26. None
  27. None