2023-05-10 15:07:02 +08:00
|
|
|
FROM ubuntu:20.04
|
|
|
|
RUN apt-get update
|
2023-05-10 17:41:15 +08:00
|
|
|
|
|
|
|
RUN DEBIAN_FRONTEND=noninteractive apt install -y tzdata
|
2023-05-10 15:07:02 +08:00
|
|
|
# basics
|
2023-05-10 17:41:15 +08:00
|
|
|
RUN apt-get install -y libssl-dev curl libmysqlclient-dev imagemagick nodejs mysql-server redis-server
|
2023-05-10 15:21:57 +08:00
|
|
|
RUN ln -fs /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
|
2023-05-10 15:07:02 +08:00
|
|
|
# confirm openssl version
|
|
|
|
RUN openssl version
|
|
|
|
RUN which openssl
|
|
|
|
# install RVM, Ruby, and Bundler
|
|
|
|
RUN \curl -L https://get.rvm.io | bash -s stable
|
2023-05-10 17:41:15 +08:00
|
|
|
# rvm environment variable
|
|
|
|
RUN /bin/bash -l -c "source /etc/profile.d/rvm.sh"
|
2023-05-10 15:07:02 +08:00
|
|
|
RUN /bin/bash -l -c "rvm requirements"
|
|
|
|
# replace ruby mirror url, accelerate install ruby
|
|
|
|
RUN sed -i 's/rvm_remote_server_url2/#rvm_remote_server_url2/g' /usr/local/rvm/config/db
|
|
|
|
RUN sed -i 's/cache.ruby-lang.org/cache.ruby-china.com/g' /usr/local/rvm/config/db
|
|
|
|
# install ruby
|
|
|
|
RUN /bin/bash -l -c "rvm install 2.4.5"
|
|
|
|
# confirm ruby version
|
|
|
|
RUN /bin/bash -l -c "rvm list"
|
|
|
|
RUN /bin/bash -l -c "ruby -v"
|
|
|
|
|
|
|
|
#RUN apt-get install -y nodejs
|
2022-09-02 11:15:35 +08:00
|
|
|
|
|
|
|
WORKDIR /home/app/gitlink
|
|
|
|
|
|
|
|
ADD ./ /home/app/gitlink
|
|
|
|
|
2023-05-10 15:07:02 +08:00
|
|
|
RUN cd /home/app/gitlink
|
2022-09-02 11:15:35 +08:00
|
|
|
|
2023-05-10 15:07:02 +08:00
|
|
|
RUN /bin/bash -l -c 'gem sources --add https://gems.ruby-china.com/ --remove https://rubygems.org/'
|
2022-09-02 11:15:35 +08:00
|
|
|
|
2023-05-10 15:07:02 +08:00
|
|
|
RUN /bin/bash -l -c 'gem update --system'
|
2022-09-02 11:15:35 +08:00
|
|
|
|
2023-05-10 15:07:02 +08:00
|
|
|
RUN /bin/bash -l -c 'gem install bundler -v 2.3.26'
|
|
|
|
RUN /bin/bash -l -c 'gem install rake'
|
|
|
|
RUN /bin/bash -l -c 'gem install puma -v 5.6.5'
|
2022-09-02 11:15:35 +08:00
|
|
|
|
2023-05-10 15:07:02 +08:00
|
|
|
RUN rm -rf Gemfile.lock
|
2022-09-02 11:15:35 +08:00
|
|
|
|
2023-05-10 15:07:02 +08:00
|
|
|
RUN cp config/configuration.yml.example config/configuration.yml
|
2023-05-10 17:41:15 +08:00
|
|
|
RUN cp config/database-docker.yml.example config/database.yml
|
2023-05-10 15:07:02 +08:00
|
|
|
RUN touch config/redis.yml
|
|
|
|
RUN touch config/elasticsearch.yml
|
2022-09-02 11:15:35 +08:00
|
|
|
|
2023-05-10 15:07:02 +08:00
|
|
|
RUN /bin/bash -l -c 'bundle install'
|
2022-09-02 11:15:35 +08:00
|
|
|
|
2023-05-10 17:41:15 +08:00
|
|
|
RUN redis-server &
|
|
|
|
|
|
|
|
RUN /bin/bash -l -c 'bundle exec rake sync_table_structure:import_csv'
|
|
|
|
|
|
|
|
RUN /bin/bash -l -c 'rails db:migrate RAILS_ENV=development'
|
|
|
|
|
|
|
|
RUN /bin/bash -l -c 'bundle exec sidekiq -C config/sidekiq.yml -e production -d'
|
|
|
|
|
|
|
|
EXPOSE 4000
|
|
|
|
RUN /bin/bash -l -c 'RAILS_ENV=production puma -C config/puma.rb'
|