-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
50 additions
and
9 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Ignore all | ||
* | ||
|
||
# Allow sources | ||
!/exe/service.rb | ||
!/app | ||
!/lib | ||
# !Gemfile | ||
# !Gemfile.lock | ||
|
||
# Ignore inside sources | ||
**/*~ |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
FROM ruby:latest | ||
WORKDIR /usr/src/app/ | ||
RUN bundle install | ||
ADD . /usr/src/app/ | ||
EXPOSE 3333 | ||
CMD ["ruby", "/usr/src/app/hello.rb"] | ||
FROM ruby:3.2.2 | ||
WORKDIR /app | ||
# COPY Gemfile Gemfile.lock . | ||
# ENV BUNDLER_WITHOUT development test | ||
# RUN gem update --system && bundle install | ||
ADD . . | ||
CMD ["ruby", "/app/exe/service.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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
namespace :docker do | ||
|
||
DOCKER = 'docker'.freeze | ||
|
||
desc 'Up mounted /app' | ||
task :local do | ||
# for Docker on Windows, add folder (Settings->Resources->File Sharing) and retart Docker | ||
# docker run --rm -it --mount type=bind,source=.,destination=/app ruby:3.2.2 /bin/sh | ||
system "#{DOCKER} run --rm -it --mount type=bind,source=.,destination=/app ruby:3.2.2 /bin/sh" | ||
end | ||
|
||
desc "Build Docker Image" | ||
task :build, :tag do |t, args| | ||
args.with_defaults(tag: 'dummy') | ||
system "#{DOCKER} build . -t #{args.tag}" | ||
end | ||
|
||
desc "Run Docker Image" | ||
task :run, :command do |t, args| | ||
args.with_defaults(command: '') # /bin/sh | ||
system "#{DOCKER} run --rm -it --mount type=bind,source=.,destination=/app dummy #{args.command}" | ||
end | ||
|
||
end |