From bf1ffadf41fd9a2fc73bcc3d259a2992146169c6 Mon Sep 17 00:00:00 2001 From: xxq250 Date: Wed, 10 May 2023 17:41:15 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B4=E7=90=86docker=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1869ff31e..c7320f6cd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,13 +1,17 @@ FROM ubuntu:20.04 RUN apt-get update + +RUN DEBIAN_FRONTEND=noninteractive apt install -y tzdata # basics -RUN apt-get install -y libssl-dev curl libmysqlclient-dev imagemagick nodejs mysql-server redis-server tzdata +RUN apt-get install -y libssl-dev curl libmysqlclient-dev imagemagick nodejs mysql-server redis-server RUN ln -fs /usr/share/zoneinfo/Asia/Shanghai /etc/localtime # confirm openssl version RUN openssl version RUN which openssl # install RVM, Ruby, and Bundler RUN \curl -L https://get.rvm.io | bash -s stable +# rvm environment variable +RUN /bin/bash -l -c "source /etc/profile.d/rvm.sh" 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 @@ -37,11 +41,19 @@ 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 cp config/database-docker.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' \ No newline at end of file +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' \ No newline at end of file