-
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
2 changed files
with
28 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,35 @@ | ||
FROM ruby:2.7 | ||
FROM ruby:2.7-alpine AS build-env | ||
|
||
WORKDIR /usr/src/app | ||
|
||
# Upgrade | ||
RUN apk update --no-cache | ||
|
||
COPY Gemfile Gemfile.lock ./ | ||
RUN bundle config --global frozen 1 \ | ||
&& bundle config --local deployment true \ | ||
&& bundle config --local path vendor/bundle \ | ||
&& bundle config --local without development \ | ||
&& bundle config --local jobs 5 \ | ||
&& bundle install \ | ||
&& rm -rf vendor/bundle/ruby/2.7.0/cache/*.gem \ | ||
&& find vendor/bundle/ruby/2.7.0/gems/ -name "*.c" -delete \ | ||
&& find vendor/bundle/ruby/2.7.0/gems/ -name "*.o" -delete | ||
|
||
COPY amber-electric.rb . | ||
|
||
# Main image | ||
FROM ruby:2.7-alpine | ||
|
||
ENV INFLUXDB_HOSTNAME influxdb | ||
ENV INFLUXDB_DATABASE amber_electric | ||
|
||
WORKDIR /usr/src/app | ||
|
||
RUN bundle config --global frozen 1 | ||
COPY Gemfile Gemfile.lock ./ | ||
RUN bundle install | ||
# Upgrade | ||
RUN apk update --no-cache | ||
|
||
COPY . . | ||
COPY --from=build-env /usr/src/app /usr/src/app | ||
COPY --from=build-env /usr/local/bundle/config /usr/local/bundle/config | ||
|
||
CMD ["./amber-electric.rb"] | ||
CMD ["bundle", "exec", "./amber-electric.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