Created
December 3, 2019 17:19
-
-
Save edmorley/85dd6a99f8d21c6f730551fb1d8b0d91 to your computer and use it in GitHub Desktop.
libpq v12 testcase: ruby-pg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
testcase: | |
build: . | |
links: | |
- db | |
db: | |
image: postgres:11.5-alpine |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ruby:2.6.5-buster | |
RUN curl -fsSL https://www.postgresql.org/media/keys/ACCC4CF8.asc -o /etc/apt/trusted.gpg.d/pgdg.asc | |
RUN echo 'deb http://apt.postgresql.org/pub/repos/apt/ buster-pgdg main' > /etc/apt/sources.list.d/pgdg.list | |
RUN apt-get update \ | |
&& apt-get install -y --no-install-recommends libpq-dev \ | |
&& rm -rf /var/lib/apt/lists/* | |
RUN gem install pg | |
COPY testcase.rb . | |
CMD ["ruby", "testcase.rb"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "pg" | |
connection_parameters = { | |
host: "db", | |
user: "postgres", | |
connect_timeout: "15s", | |
} | |
conn = PG.connect(connection_parameters) | |
conn.exec("SELECT 'test'") do |result| | |
puts "Succeeded" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment