Update Dockerfile

This commit is contained in:
xxq250 2023-05-10 15:07:02 +08:00
parent 0c982bc4a5
commit 3a0b8c0e9b
1 changed files with 33 additions and 20 deletions

View File

@ -1,33 +1,46 @@
FROM ubuntu:18.04
FROM ubuntu:20.04
RUN apt-get update
# basics
RUN apt-get install -y libssl-dev curl libmysqlclient-dev imagemagick nodejs mysql-server redis-server
# confirm openssl version
RUN openssl version
RUN which openssl
# install RVM, Ruby, and Bundler
RUN \curl -L https://get.rvm.io | bash -s stable
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 update
RUN apt install -y openssl libssl-dev imagemagick git ruby-dev nodejs libmariadb-dev libmysqlclient-dev shared-mime-info libpq-dev libxml2-dev libxslt-dev
RUN DEBIAN_FRONTEND="noninteractive" apt -y install tzdata
RUN ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
#RUN apt-get install -y nodejs
WORKDIR /home/app/gitlink
ADD ./ /home/app/gitlink
RUN gem sources --add https://gems.ruby-china.com/ --remove https://rubygems.org/
RUN cd /home/app/gitlink
RUN gem update --system
RUN /bin/bash -l -c 'gem sources --add https://gems.ruby-china.com/ --remove https://rubygems.org/'
RUN gem install bundler
RUN gem install rake
RUN /bin/bash -l -c 'gem update --system'
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'
RUN rm -rf Gemfile.lock
#RUN cp config/configuration.yml.example config/configuration.yml
#RUN cp config/database.yml.example config/database.yml
#RUN touch config/redis.yml
#RUN touch config/elasticsearch.yml
RUN bundle install
EXPOSE 4000
RUN rails s -p 4000 -b '0.0.0.0'
RUN cp config/configuration.yml.example config/configuration.yml
RUN cp config/database.yml.example config/database.yml
RUN touch config/redis.yml
RUN touch config/elasticsearch.yml
RUN /bin/bash -l -c 'bundle install'
#EXPOSE 4000
#RUN /bin/bash -l -c 'RAILS_ENV=production puma'