Skip to content

Commit

Permalink
[CP] Dockerize Community Platform (aptos-labs#879)
Browse files Browse the repository at this point in the history
  • Loading branch information
CapCap authored May 9, 2022
1 parent b9faf4b commit f05204a
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 0 deletions.
42 changes: 42 additions & 0 deletions ecosystem/platform/server/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
#
# If you find yourself ignoring temporary files generated by your text editor
# or operating system, you probably want to add a global ignore instead:
# git config --global core.excludesfile '~/.gitignore_global'

# Ignore bundler config.
/.bundle

# Ignore the default SQLite database.
/db/*.sqlite3
/db/*.sqlite3-*

# Ignore all logfiles and tempfiles.
/log/*
/tmp/*
!/log/.keep
!/tmp/.keep

# Ignore pidfiles, but keep the directory.
/tmp/pids/*
!/tmp/pids/
!/tmp/pids/.keep

# Ignore uploaded files in development.
/storage/*
!/storage/.keep
/tmp/storage/*
!/tmp/storage/
!/tmp/storage/.keep

# Ignore asset builds.
/app/assets/builds

/public/assets

# Ignore master key for decrypting credentials and more.
/config/master.key
/config/credentials.yml.enc

# Never commit this dangerous file :-)
.env
34 changes: 34 additions & 0 deletions ecosystem/platform/server/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
FROM ruby:3.1.2-slim

RUN apt-get update -qq && apt-get install -yq --no-install-recommends \
build-essential \
gnupg2 \
less \
git \
libpq-dev \
postgresql-client \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

RUN gem update --system && gem install bundler

WORKDIR /usr/src/app

COPY Gemfile Gemfile.lock ./

ENV RAILS_ENV production
ENV RAILS_SERVE_STATIC_FILES true
ENV RAILS_LOG_TO_STDOUT true

RUN bundle config --global frozen 1
RUN bundle config set --local without 'development test'
RUN bundle install

COPY . /usr/src/app

# this is a fake secret key just to get it to compile the assets
ENV SECRET_KEY_BASE=18ff7d41b9da02d394434e2eb140611516707334b7d7a7e15cf8b567061f30e9400a82e61aa772b9e6ccb72853932769d03bbbb9d78f62333c8f7adb95cc727d

RUN bundle exec rake assets:precompile

EXPOSE 3000
CMD ["bundle", "exec", "rails", "s", "-b", "0.0.0.0"]
5 changes: 5 additions & 0 deletions ecosystem/platform/server/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,8 @@ GEM
net-protocol
timeout
nio4r (2.5.8)
nokogiri (1.13.4-aarch64-linux)
racc (~> 1.4)
nokogiri (1.13.4-arm64-darwin)
racc (~> 1.4)
nokogiri (1.13.4-x86_64-linux)
Expand Down Expand Up @@ -344,6 +346,8 @@ GEM
stimulus-rails (1.0.4)
railties (>= 6.0.0)
strscan (3.0.1)
tailwindcss-rails (2.0.8-aarch64-linux)
railties (>= 6.0.0)
tailwindcss-rails (2.0.8-arm64-darwin)
railties (>= 6.0.0)
tailwindcss-rails (2.0.8-x86_64-linux)
Expand Down Expand Up @@ -376,6 +380,7 @@ GEM
zeitwerk (2.5.4)

PLATFORMS
aarch64-linux
arm64-darwin-21
x86_64-linux

Expand Down

0 comments on commit f05204a

Please sign in to comment.