Created
April 10, 2020 13:40
-
-
Save azechi/fefb0ee8266da1d4cfed018c0884410c to your computer and use it in GitHub Desktop.
docker discordrb
This file contains hidden or 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 'discordrb' | |
bot = Discordrb::Bot.new token: ENV["TOKEN"] | |
bot.message(with_text: 'Ping!') do |event| | |
event.respond 'Pong!' | |
end | |
require 'thread' | |
Signal.trap(:TERM) do | |
Thread.new { bot.stop } | |
end | |
bot.run |
This file contains hidden or 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 AS builder | |
COPY Gemfile Gemfile.lock ./ | |
RUN env DEBCONF_NOWARNINGS=yes bundle install -j "$(getconf _NPROCESSORS_ONLN)" --retry 3 \ | |
&& rm -rf /usr/local/bundle/cache/*.gem \ | |
&& find /usr/local/bundle/gems/ -name '*.c' -delete \ | |
&& find /usr/local/bundle/gems/ -name '*.o' -delete | |
# app | |
FROM ruby:slim | |
RUN apt-get update \ | |
&& apt-get upgrade -y \ | |
&& apt-get install -y --no-install-recommends libsodium-dev \ | |
&& apt-get clean \ | |
&& rm -rf /var/lib/apt/lists/* | |
COPY --from=builder /usr/local/bundle /usr/local/bundle | |
COPY ./app . | |
CMD ["ruby", "bot.rb"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment