I'd love to set up continuous deployment in Bitbucket Pipelines for a Ruby on Rails / PostgreSQL / Sidekiq project, but I'm struggling to get my head around how it all fits together, and specifically how to get postgres working inside a Docker image. I'm very new to Docker and Pipelines.
In my Googling, Docker talks about using docker-compose to create a bundle, so I'd have a Postgres container and a Sideqik container, then link them with the app container. But I'm not sure what the difference is between a bundle and an image, and if Bitbucket Pipelines supports bundles. Eventually I want to set up deployments to a staging environment on Heroku, but for now just getting rspec spec
to work in Pipelines would be nice.
Is there an existing public image that has Ruby + PostgreSQL already set up that I can use? If not, where do I start? My current Dockerfile looks like this:
FROM postgres:9.4
FROM ruby:2.3.1-onbuild
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs postgresql-client
I then run docker build .
and docker run -it my-image /bin/bash
and the following commands:
root@a84ad0e7c16b:/usr/src/app# postgres
bash: postgres: command not found
root@a84ad0e7c16b:/usr/src/app# psql
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?