1

I'm using simple docker-compose container images. Here's my docker-compose.yml

    version: '2'

    services:
      db:
        image: postgres:10.2
        ports:
          - "5432:5432"
        environment:
          ... skipped for brevity
        volumes:
          - "./server:/docker-entrypoint-initdb.d"

      postgrest:
        image: postgrest/postgrest
        ports:
          - "3000:3000"
        environment:
         ... skipped for brevity

      webapp:
        image: node:8.9
        ports:
          - "3001:3001"
        volumes:
          - "./client:/client"
          - "./package.json:/client/package.json"
          - "./node_modules:/client/node_modules"
        environment:
          - API_URL=${API_URL}
        working_dir: /client
        command: npm run dev -- -p 3001

which I want to deploy to AWS Elasticbeanstalk using CodePipeline. As I don't have any build step (thus no Dockerfile) I'm wondering how to instruct my buildspec.yml

    version: 0.2

    phases:
      install:
        commands:
          - echo starting on `date`
          - npm install
      pre_build:
        commands:
          - cp .env.example .env
      build:
        commands:
          - docker-compose up -d

      post_build:
        commands:
          - echo completing on `date`

to properly build using docker-compose?

I believe I just need a Dockerrun.aws.json file although CodePipeline is expecting some build artifact:

AWS CodePipeline staging step wants a build artifact

How did you solve this in your scenario?

  • Bind mounting your application code into your container only helps you when it's running on a machine that has the code on it. You need to build a Docker image with your application in it for it to actually work elsewhere. – ydaetskcoR Feb 24 '18 at 15:28
  • @ydaetskcoR so I can use docker pull ... and docker save in order to have all images saved as .tar file and push that to AWS? – Vitaliy Filipov Feb 26 '18 at 16:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.