John Costanzo

Using Docker at Work for Local Development

Using Docker at Work for Local Development

At the company I work for we wanted to setup Docker so local developers do not have to do all this work to get their machines configured for any projects. We also wanted to get away from have documentation for different developer laptops. We use Macs, Linux, and Windows machines. So now I have decided to go down the path of learning how to set this up and get this working for everyone.

Docker whale

Before I started learning, what I thought what we were eventually going to get is, one set of files that would work no matter what operating system our devs were using. So then I started research about Docker. I started by going through Docker's documentation. I took a course in Pluralsight about it. Then I started searching YouTube for Docker talks to get me in understanding the basics. I still have way more things to learn but I feel like I am going down the right path.

So now I was ready to figure out what I needed Docker to do for us. I know that I need 2 services. One service was for EmberJS and the other service is for our web server Nginx. So I started by creating a Dockerfile for the Ember service.

FROM node:8.11.1-alpine
LABEL maintainer="John"


RUN apk add --no-cache \\
  git && \\
  yarn global add ember-cli@$EMBER_VERSION bower@latest && \\
  mkdir -p $APP_DIR && \\
  cd $APP_DIR

COPY ./docker/ /

EXPOSE 4200 7357 8080 9222 7020

CMD ["/"]

This will create a NodeJS image that has bower, yarn, and EmberJS. Now we are ready to build our docker-compose.yml file.

version: '3'


    build: .
    container_name: ember-app
      - 7357:7357
      - 4200:4200
      - 9222:9222
      - 49152:49152
      - .:/myapp
      - ember-bower_components:/myapp/bower\_components
      - ember-node_modules:/myapp/node\_modules
      - ./docker/
      - /myapp/tmp
      - API_HOST=http://someapi
      - API_KEY=sdfdfdsfdsfdsfsdfsdfsdf
    command: ["sh", "/"\]
    image: nginx:1.12.1-alpine
    container_name: nginx-app
      - 8081:8080
      - ember
      - ./docker/default.template:/etc/nginx/conf.d/default.template
      - ./dist:/usr/share/nginx/html:delegated
      - SERVER_NAME=localhost
    command: /bin/sh -c "envsubst < /etc/nginx/conf.d/default.template > /etc/nginx/conf.d/default.conf && nginx -g 'daemon off;'"

So this got the Mac and Windows guys working. They can run docker-compose up and get working on the code. If they needed to create a new component they just ran something like docker exec -it ember-app ember g component my-component. They continued to work just fine. So then I went fired up my Solus Linux and started it up. It worked just fine. So now I wanted to create a new component to test that out and it generated it. But when I opened the component and made some changes and hit save, I got a permission error.

So this is where I end this first part of the journey. Its now off to go figure a solution that will fix the Linux side, but also not break the Windows and Mac guys. So make sure to check back for part 2 that will talk about the solution I found. Any questions or comments, please leave a comment