6

Every time I onboard a new person on my team I have to go through the same routine of installing everything, figuring out what changed since last time we onboarded someone etc. Not fun.

I've heard about people maintaining docker containers with the development environment, but I'm not sure how to accomplish this.

Let's say you work on a repository containing a React webapp. Our IDE of choice is IntelliJ. It'd be cool if a new dev would just get a container with all the necessary dev stuff installed.

How do I make this happen?

2
  • 1
    Nearly the same way as with Virtual Machine. There are a lot of guides for creating a dev environment in a VM. Try to search Google/SO for that and ask more specific questions? Nov 13, 2017 at 23:31
  • when you say you want a development environment, you mean you want the React app in the container. That's it? What specifically is "all the necessary dev stuff" you want installed?
    – bluescores
    Nov 14, 2017 at 13:28

3 Answers 3

8

The onboarding experience should be almost as simple as telling your new developer to just clone the repo and run docker-compose up. Personally I wouldn't bother worrying about IDE integration because people might prefer to use different IDEs.

Every project/application (if you have multiple) should be able to run separately and each project/application should have it's own codebase. That's a concept from The Twelve-Factor App methodology.

In the root of each project add a Dockerfile and a docker-compose.yml file.

NOTE: I created Craft Kits which you can use to automatically generate these files for the framework/language you're using with one command (e.g. mason craft nodejs), you don't even need to know Docker.

The Dockerfile will build your application into an image, installing and dependencies your application needs to run. This image is the image that runs your app.

FROM node:8.8-alpine

# Set our workdir
WORKDIR /app

# Install and cache app dependencies
COPY package.json /app
RUN npm install 

# Add project files
COPY . /app

# start app
CMD [ "npm", "start" ]

The docker-compose.yml file will spin up your environment. It will define all the services Docker should start for your application

version: '2'
services:
  web:
    build: .
    volumes:
      - ./:/app
    ports:
      - "3000:3000"

  mongodb:
    image: mongodb
    volumes:
      - ./storage/data/mongodb:/data/db
    ports:
      - "27017:27017"

When you onboard a new developer, you can just tell them to git clone your repo and to fire up their development environment by running:

docker-compose up -d 

The advantage of this approach when you are developing locally, running docker-compose up will mount your code as a volume.

Then when you want to deploy, when you build your Dockerfile it will copy your code into your image so everything is packaged up nicely and easily moved around.

We use the same approach for apps on Codemason, my service for building, managing and scaling container-based applications. When you push new code, we automatically build an image from your Dockerfile. Since that image contains everything your app needs to run, it can be easily launched on any server and scaled up/down across multiple servers.

0
0

If you are open to try other things than IntelliJ, there is for example Eclipse Che which runs in container. Ideally there will be plugins for other components of your DevOps toolchains.

0


There are several ways to achieve it, depend on which one, you like.
The most simple and easy is, get the docker image and create environment in it and save it for later, so when the member joins, you just need to start that image and whole environment is created FYI :
Docker for dev
or
Dev Environment

NOTE: These links are for PHP you need to figure out for other languages that you prefer. Hope this helps

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.