Skip to content

Commit

Permalink
refactor: local docker development (#333)
Browse files Browse the repository at this point in the history
Co-authored-by: Alex Kubacki <[email protected]>
  • Loading branch information
neurosnap and UserNotFound authored Jun 3, 2024
1 parent 8e60f37 commit ec6b9ce
Show file tree
Hide file tree
Showing 8 changed files with 240 additions and 23 deletions.
20 changes: 20 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
*.gem
*.rbc
*.dump
.bundle
.config
.yardoc
InstalledFiles
_yardoc
coverage
doc/
lib/bundler/man
pkg
rdoc
spec/reports
test/tmp
test/version_tmp
tmp
/.idea
/.vscode
Makefile
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
.bundle
.config
.yardoc
Gemfile.lock
InstalledFiles
_yardoc
coverage
Expand Down
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ rvm:
- "2.7"

before_install:
- ./cleanup_bundler
- gem install bundler -v '< 2'
script:
- bundle exec rake
- bundle exec script/sync-readme-usage
- git diff --exit-code
env:
- BUNDLER_VERSION=1.17.3
25 changes: 21 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,27 @@
FROM ruby:2.7.8

# Install and use an compatible bundler
ENV BUNDLER_VERSION=1.17.3
RUN gem install bundler -v "${BUNDLER_VERSION}"

# Install required gems before copying in code
# to avoid re-installing gems when developing
WORKDIR /app
COPY . /app
COPY Gemfile /app
COPY Gemfile.lock /app
COPY aptible-cli.gemspec /app

# We reference the version, so copy that in, too
CMD mkdir -p /app/lib/aptible/cli/
COPY lib/aptible/cli/version.rb /app/lib/aptible/cli/

RUN ./cleanup_bundler
RUN gem install bundler -v '< 2'
RUN bundle install

CMD ["/app/bin/aptible"]
COPY . /app

# Save on typing while testing
RUN echo '#!/bin/bash' > /usr/bin/aptible \
&& echo 'bundle exec bin/aptible $@' >> /usr/bin/aptible \
&& chmod +x /usr/bin/aptible

CMD ["aptible"]
184 changes: 184 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
GIT
remote: https://github.com/fancyremarker/pry.git
revision: be3823aa4ffc51260f2f3ce84f0984da3dc6dd10
branch: aptible
specs:
pry (0.10.0)
coderay (~> 1.1.0)
method_source (~> 0.8.1)
slop (~> 3.4)

PATH
remote: .
specs:
aptible-cli (0.19.8)
activesupport (>= 4.0, < 6.0)
aptible-api (~> 1.4)
aptible-auth (~> 1.2.4)
aptible-billing (~> 1.0)
aptible-resource (~> 1.1)
aws-sdk (~> 2.0)
bigdecimal (~> 1.3.5)
cbor
chronic_duration (~> 0.10.6)
git (< 1.10)
term-ansicolor
thor (~> 0.20.0)

GEM
remote: https://rubygems.org/
specs:
activesupport (4.2.11.3)
i18n (~> 0.7)
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
addressable (2.8.0)
public_suffix (>= 2.0.2, < 5.0)
aptible-api (1.5.1)
aptible-auth (~> 1.0)
aptible-resource (~> 1.0)
gem_config
multipart-post (< 2.2.0)
aptible-auth (1.2.5)
aptible-resource (~> 1.0)
gem_config
multipart-post (= 2.1.1)
oauth2 (= 1.4.7)
aptible-billing (1.0.1)
activesupport (>= 4.0, < 6.0)
aptible-resource (~> 1.0)
stripe (>= 1.13.0)
aptible-resource (1.1.2)
activesupport
fridge
gem_config (~> 0.3.1)
httpclient (~> 2.8)
json
uri_template (>= 0.5.2)
aptible-tasks (0.5.9)
rake (>= 10, < 13.0)
rubocop (= 0.42.0)
ast (2.4.2)
aws-eventstream (1.1.1)
aws-sdk (2.11.632)
aws-sdk-resources (= 2.11.632)
aws-sdk-core (2.11.632)
aws-sigv4 (~> 1.0)
jmespath (~> 1.0)
aws-sdk-resources (2.11.632)
aws-sdk-core (= 2.11.632)
aws-sigv4 (1.2.4)
aws-eventstream (~> 1, >= 1.0.2)
bigdecimal (1.3.5)
cbor (0.5.9.8)
chronic_duration (0.10.6)
numerizer (~> 0.1.1)
climate_control (0.0.3)
activesupport (>= 3.0)
coderay (1.1.3)
concurrent-ruby (1.1.9)
connection_pool (2.2.3)
crack (1.0.0)
bigdecimal
rexml
diff-lcs (1.5.1)
fabrication (2.15.2)
faraday (0.17.6)
multipart-post (>= 1.2, < 3)
fridge (0.2.2)
gem_config
jwt
gem_config (0.3.2)
git (1.7.0)
rchardet (~> 1.8)
hashdiff (1.1.0)
httpclient (2.8.3)
i18n (0.9.5)
concurrent-ruby (~> 1.0)
jmespath (1.6.2)
json (2.5.1)
jwt (2.3.0)
method_source (0.8.2)
minitest (5.12.0)
multi_json (1.15.0)
multi_xml (0.6.0)
multipart-post (2.1.1)
net-http-persistent (3.1.0)
connection_pool (~> 2.2)
numerizer (0.1.1)
oauth2 (1.4.7)
faraday (>= 0.8, < 2.0)
jwt (>= 1.0, < 3.0)
multi_json (~> 1.3)
multi_xml (~> 0.5)
rack (>= 1.2, < 3)
parser (2.7.2.0)
ast (~> 2.4.1)
powerpack (0.1.3)
public_suffix (3.1.1)
rack (1.6.13)
rainbow (2.2.2)
rake
rake (12.3.3)
rchardet (1.8.0)
rexml (3.2.5)
rspec (3.13.0)
rspec-core (~> 3.13.0)
rspec-expectations (~> 3.13.0)
rspec-mocks (~> 3.13.0)
rspec-core (3.13.0)
rspec-support (~> 3.13.0)
rspec-expectations (3.13.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-mocks (3.13.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-support (3.13.1)
rubocop (0.42.0)
parser (>= 2.3.1.1, < 3.0)
powerpack (~> 0.1)
rainbow (>= 1.99.1, < 3.0)
ruby-progressbar (~> 1.7)
unicode-display_width (~> 1.0, >= 1.0.1)
ruby-progressbar (1.13.0)
slop (3.6.0)
stripe (4.24.0)
faraday (~> 0.13)
net-http-persistent (~> 3.0)
sync (0.5.0)
term-ansicolor (1.8.0)
tins (~> 1.0)
thor (0.20.3)
thread_safe (0.3.6)
tins (1.33.0)
bigdecimal
sync
tzinfo (1.2.11)
thread_safe (~> 0.1)
unicode-display_width (1.8.0)
uri_template (0.7.0)
webmock (3.16.2)
addressable (>= 2.8.0)
crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0)

PLATFORMS
ruby

DEPENDENCIES
activesupport (~> 4.0)
aptible-cli!
aptible-tasks (~> 0.5.8)
bundler (~> 1.3)
climate_control (= 0.0.3)
fabrication (~> 2.15.2)
pry!
rack (~> 1.0)
rake
rspec (~> 3.2)
webmock

BUNDLED WITH
1.17.3
10 changes: 10 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
build:
docker compose build --pull

bash: build
docker compose run cli bash

test: build
docker compose run cli bundle exec rake

.PHONY: build bash test
14 changes: 0 additions & 14 deletions cleanup_bundler

This file was deleted.

6 changes: 3 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
services:
# docker compose run cli bash
# export APTIBLE_ACCESS_TOKEN=xxx
# bundle exec ./bin/aptible help
cli:
build: .
volumes:
- type: bind
source: .
target: /app
- type: bind
source: $HOME/.aptible/tokens.json
target: /root/.aptible/tokens.json

0 comments on commit ec6b9ce

Please sign in to comment.