mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-21 05:17:08 +00:00
add dockerfile for ror, fix template issue (#718)
This commit is contained in:
@@ -122,7 +122,7 @@ public class RubyOnRailsServerCodegen extends AbstractRubyCodegen {
|
||||
additionalProperties.put("isDBSQLite", Boolean.TRUE);
|
||||
}
|
||||
|
||||
supportingFiles.add(new SupportingFile("Gemfile", "", "Gemfile"));
|
||||
supportingFiles.add(new SupportingFile("Gemfile.mustache", "", "Gemfile"));
|
||||
supportingFiles.add(new SupportingFile("README.md", "", "README.md"));
|
||||
supportingFiles.add(new SupportingFile("Rakefile", "", "Rakefile"));
|
||||
supportingFiles.add(new SupportingFile("config.ru", "", "config.ru"));
|
||||
@@ -155,7 +155,7 @@ public class RubyOnRailsServerCodegen extends AbstractRubyCodegen {
|
||||
supportingFiles.add(new SupportingFile("application.rb", configFolder, "application.rb"));
|
||||
supportingFiles.add(new SupportingFile("boot.rb", configFolder, "boot.rb"));
|
||||
supportingFiles.add(new SupportingFile("cable.yml", configFolder, "cable.yml"));
|
||||
supportingFiles.add(new SupportingFile("database.yml", configFolder, "database.yml"));
|
||||
supportingFiles.add(new SupportingFile("database.mustache", configFolder, "database.yml"));
|
||||
supportingFiles.add(new SupportingFile("environment.rb", configFolder, "environment.rb"));
|
||||
supportingFiles.add(new SupportingFile("puma.rb", configFolder, "puma.rb"));
|
||||
supportingFiles.add(new SupportingFile("routes.mustache", configFolder, "routes.rb"));
|
||||
@@ -181,6 +181,8 @@ public class RubyOnRailsServerCodegen extends AbstractRubyCodegen {
|
||||
supportingFiles.add(new SupportingFile(".keep", socketsFolder, ".keep"));
|
||||
supportingFiles.add(new SupportingFile("restart.txt", tmpFolder, "restart.txt"));
|
||||
supportingFiles.add(new SupportingFile(".keep", vendorFolder, ".keep"));
|
||||
supportingFiles.add(new SupportingFile("Dockerfile", "", "Dockerfile"));
|
||||
supportingFiles.add(new SupportingFile("docker-entrypoint.sh", "", "docker-entrypoint.sh"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
FROM ruby:2.5-alpine
|
||||
|
||||
ENV BUILD_PACKAGES="curl-dev ruby-dev build-base" \
|
||||
DEV_PACKAGES="zlib-dev libxml2-dev libxslt-dev tzdata yaml-dev sqlite-dev" \
|
||||
RUBY_PACKAGES="ruby-json yaml nodejs"
|
||||
|
||||
RUN apk update && \
|
||||
apk upgrade && \
|
||||
apk add --no-cache --update\
|
||||
$BUILD_PACKAGES \
|
||||
$DEV_PACKAGES \
|
||||
$RUBY_PACKAGES && \
|
||||
mkdir -p /usr/src/myapp
|
||||
|
||||
WORKDIR /usr/src/myapp
|
||||
|
||||
COPY Gemfile ./
|
||||
RUN gem install bundler
|
||||
RUN bundle config build.nokogiri --use-system-libraries && \
|
||||
bundle install --jobs=4 --retry=10 --clean
|
||||
|
||||
COPY . ./
|
||||
RUN chmod +x bin/rails
|
||||
|
||||
COPY docker-entrypoint.sh /usr/local/bin/
|
||||
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
|
||||
ENTRYPOINT ["docker-entrypoint.sh"]
|
||||
|
||||
CMD ["bin/rails", "s", "-b", "0.0.0.0"]
|
||||
@@ -0,0 +1,9 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
if [ "$1" = 'bin/rails' ] && [ "$2" = 's' ]; then
|
||||
rm -f /myapp/tmp/pids/server.pid
|
||||
bin/rails db:migrate
|
||||
fi
|
||||
|
||||
exec "$@"
|
||||
Reference in New Issue
Block a user