I’m trying to setup CircleCI to fetch my code, build a Docker image and run the tests within that image.
Any idea why it complains about the missing Gemfile?
docker-compose up --build --force-recreate pepper
works without any errors locally. But as soon as I’m on Circle it complains about a missing /app/Gemfile.
This file is explicit copied and present if I run $ docker build . -t pepper && docker run -it pepper ls /app/Gemfile
.circleci/config.yml
version: 2
jobs:
build:
working_directory: /app
docker:
- image: docker:17.05.0-ce-git
steps:
- checkout
- setup_remote_docker
- run:
name: Install dependencies
command: |
apk add --no-cache \
py-pip=9.0.0-r1
pip install \
docker-compose==1.12.0 \
awscli==1.11.76
- run:
name: Run tests
command: |
docker-compose run pepper rspec && rake test
- deploy:
name: Push application Docker image
command: |
echo "pushing to docker hub"
docker-compose.yml
version: '3.2'
services:
db:
container_name: db
image: postgres:10.4
volumes:
- postgres:/var/lib/postgres/data
dns: 8.8.8.8
networks:
- pepper
environment:
- POSTGRES_USER=user
- POSTGRES_PASSWORD=pass
- POSTGRES_NAME=pepper_test
pepper:
build: .
depends_on:
- "db"
dns: 8.8.8.8
networks:
- pepper
container_name: pepper
ports:
- "3000:3000"
environment:
- POSTGRES_USER=user
- POSTGRES_PASSWORD=pass
- POSTGRES_NAME=pepper_test
- POSTGRES_HOST=db
networks:
pepper:
driver: bridge
volumes:
postgres:
Dockerfile
FROM my-user/rails-bundled:1
COPY Gemfile* /app/
COPY . /app/
WORKDIR /app
CMD ["/usr/local/bundle/bin/rails", "s", "-b", "0.0.0.0"]
Dockerfile-bundled
# my-user/rails-bundled:1
FROM ruby:2.4
RUN apt-get update && apt-get install -y netcat
COPY Gemfile* /app/
WORKDIR /app
RUN bundle install