0

I have the following docker-compose.yml:

version: '3'
services:
    server:
        build:
            context: ../../
            dockerfile: ./packages/website/Dockerfile
        command: yarn serve
        environment:
            PORT: 3000
            NODE_ENV: production
        restart: always
    nginx:
        build:
            context: ./
            dockerfile: ./nginx/Dockerfile
        command: nginx -c /etc/nginx/nginx.conf -g "daemon off;"
        depends_on:
            - server
        ports:
            - "80:80"
        restart: always

What is the best way for me to get this set up into Amazon ECR?

My thoughts were to push the images that are built from the above docker-compose.yml file into an AWS repository and then create a new docker-compose.yml that used the image setting, e.g. image: ecr-image-url to reference the images.

Is there a better way?

freginold
  • 239
  • 1
  • 7
dagda1
  • 237
  • 3
  • 6
  • 19

1 Answers1

1

I would not use docker compose for builds, I would push the built images, then if I need to link them with docker-compose links https://docs.docker.com/compose/compose-file/#links

For the build you can use Jenkins(or another CI tool). The following plugin can be used on Jenkins https://wiki.jenkins.io/display/JENKINS/CloudBees+Docker+Build+and+Publish+plugin

The link command though will be deprecated soon, so the docker guys recommend to create your own network to compose your service https://docs.docker.com/compose/networking/

Alex H
  • 1,814
  • 11
  • 18