-
Notifications
You must be signed in to change notification settings - Fork 17
Added Docker support #65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| FROM ubuntu:focal | ||
|
|
||
| WORKDIR /app | ||
| COPY . /app | ||
|
|
||
| # installing all system dependencies, yq, ruby-build and rbenv | ||
| RUN apt-get update && \ | ||
| apt-get install --yes --no-install-recommends uuid-runtime curl ca-certificates git make build-essential libssl-dev libreadline-dev zlib1g-dev && \ | ||
| rm -rf /var/lib/apt/lists/* && \ | ||
| curl -L https://github.com/mikefarah/yq/releases/download/v4.24.2/yq_linux_amd64.tar.gz | tar -xzvf - && mv yq_linux_amd64 /usr/bin/yq && \ | ||
| git clone https://github.com/rbenv/rbenv.git ~/.rbenv && \ | ||
| curl -L https://github.com/sstephenson/ruby-build/archive/v20220324.tar.gz | tar -zxvf - -C /tmp/ && \ | ||
| cd /tmp/ruby-build-* && ./install.sh | ||
|
|
||
| # set the env | ||
| ENV PATH /root/.rbenv/bin:/root/.rbenv/shims:$PATH | ||
| RUN echo 'eval "$(rbenv init -)"' >> .bashrc | ||
| RUN echo 'eval "$(rbenv init -)"' >> /etc/profile.d/rbenv.sh # or /etc/profile | ||
|
|
||
| # run the make file to generate an api key an install the app | ||
| RUN make install api_key | ||
|
|
||
|
|
||
| EXPOSE 9292 | ||
| CMD ["make", "run"] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,15 +25,21 @@ build: | |
|
|
||
| install: | ||
| rbenv install -s | ||
| - gem install bundler -v 2.2.33 | ||
| - gem install bundler -v 2.2.33 && rbenv rehash | ||
| bundle install --jobs 1 | ||
| cp -n config/connectors.yml.example config/connectors.yml || true | ||
|
|
||
| run: | ||
| ${YQ} e ".revision = \"$(shell git rev-parse HEAD)\"" -i config/connectors.yml | ||
| ${YQ} e ".repository = \"$(shell git config --get remote.origin.url)\"" -i config/connectors.yml | ||
| ${YQ} e ".version = \"$(shell script/version.sh)\"" -i config/connectors.yml | ||
| cd lib/app; bundle exec rackup config.ru | ||
| cd lib/app; bundle exec rackup --host 0.0.0.0 config.ru | ||
|
|
||
| build-docker: | ||
| docker build -t connectors . | ||
|
|
||
| run-docker: | ||
| docker run --rm -it -p 127.0.0.1:9292:9292/tcp connectors | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This hardcodes the port, which may not be in alignment with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah you're right, we should not hardcore the port. For the env it sounds like a great improvement There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Filed an issue for this: https://github.com/elastic/enterprise-search-team/issues/1765 |
||
|
|
||
| console: | ||
| cd lib/app; bundle exec irb -r ./console.rb | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it depend on
build-docker? If so, should we also declare the dependency and build the image if it's not built?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes and no. if you run it without the image built, it'll fail. But it should run without re-buidling everytime. I can't think of a simple mechanism to trigger the build if it was not done when running
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair point, I was also on the fence whether it should be a hard requirement. So if the docker image was never built, we still get a somewhat meaningful error message, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.