Commit 6b95fe0
Changed files (4)
bin/docker-build
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+set -e
+
+bin/package
+
+FULL_NAME=$(ls pkg/*.tar.gz | xargs basename | cut -d'.' -f1)
+NAME=$(echo "$FULL_NAME" | cut -d'-' -f1)
+VERSION=$(echo "$FULL_NAME" | cut -d'-' -f2)
+
+docker pull ruby:2.5
+echo "Building..." $NAME:$VERSION
+docker image build \
+ -t "$NAME":"$VERSION" \
+ -t "$NAME":latest \
+ -f Dockerfile pkg/
bin/server
@@ -1,6 +1,6 @@
#!/bin/sh
-# script/server: Launch the application and any extra required processes locally.
+# bin/server: Launch the application and any extra required processes locally.
set -e
cd "$(dirname "$0")/.."
lib/package.rb
@@ -4,6 +4,7 @@ class Package
INCLUDED_FILES = [
".ruby-version",
"BUILD",
+ "Dockerfile",
"Gemfile*",
"Rakefile",
"app/**/*",
Dockerfile
@@ -0,0 +1,10 @@
+FROM ruby:2.5
+ENV RAILS_ENV production
+RUN useradd rails
+ADD *.tar.gz .
+RUN ln -s /proof-* /app && chown -R rails:rails /app/
+WORKDIR /app
+RUN bundle install --without development test --jobs "$(nproc)" --quiet # --local
+USER rails
+ENTRYPOINT ["bundle", "exec"]
+CMD ["foreman", "start"]