(wip) rewrite dockerfile

This commit is contained in:
Vri 🌈 2023-05-04 13:57:27 +02:00
parent 0e72ac66c8
commit bc541dc0fa
Signed by: vrifox
GPG key ID: D40098E5B60B2197
3 changed files with 19 additions and 32 deletions

View file

@ -20,19 +20,8 @@ RUN mkdir -p /home/srm/tmp
ARG USER_ID=1000
RUN groupadd srm && useradd --uid $USER_ID -g srm srm
RUN chown -R srm:srm /home/srm
USER srm
WORKDIR /home/srm
RUN git clone https://github.com/sstephenson/rbenv.git .rbenv
RUN git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
RUN echo 'export PATH="/home/srm/.rbenv/bin:$PATH"' >> .bashrc && echo 'eval "$(~/.rbenv/bin/rbenv init -)"' >> .bashrc && . ~/.bashrc
RUN /home/srm/.rbenv/bin/rbenv install 3.2.2
RUN /home/srm/.rbenv/bin/rbenv rehash
RUN /home/srm/.rbenv/bin/rbenv global 3.2.2
WORKDIR /home/srm/
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
@ -49,25 +38,25 @@ ENV PATH $NVM_DIR/versions/node/v$NODE_VERSION/bin:$PATH
RUN gem install bundler
RUN mkdir -p /home/srm/app
ADD . /home/srm/app
USER root
RUN chown -R srm:srm /home/srm/app
WORKDIR /
RUN mkdir -p /home/srm/build/
WORKDIR /home/srm/build/
USER srm
WORKDIR /home/srm/app
COPY bin/ bin/
COPY Gemfile Gemfile
COPY config/ config/
COPY config.ru config.ru
COPY package.json package.json
RUN bundle config build.nokogiri --use-system-libraries
RUN npm install -g yarn sass
RUN bundle update
RUN bundle install
COPY package.json package.json
USER root
RUN chown -R srm:srm package.json
WORKDIR /
RUN mkdir -p /home/srm/app/
VOLUME /home/srm/app/
RUN chown -R srm:srm /home/srm/
USER srm
RUN npm install -g yarn sass
EXPOSE 3000
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["bundle", "exec", "puma" "-C", "config/puma.rb"]
CMD bundle exec puma -C /home/srm/build/config/puma.rb

View file

@ -7,7 +7,7 @@ services:
args:
- USER_ID=${USER_ID:-1000}
volumes:
- .:/app
- .:/home/srm/app/
ports:
- "3000:3000"
links:
@ -16,7 +16,7 @@ services:
- ELASTICSEARCH_URL=${ELASTICSEARCH_URL:-http://elasticsearch:9200}
- APPLICATION_HOST=${APPLICATION_HOST:-localhost}
- SHARED_IMPORT_SECRET=$SHARED_IMPORT_SECRET
command: sh -c "cd /home/srm/app && bundle install && bundle exec puma -C config/puma.rb"
command: ls -lah /home/srm/
elasticsearch:
user: elasticsearch
build: ./docker/elasticsearch

View file

@ -3,6 +3,4 @@ set -e
if [ -f ./tmp/pids/server.pid ]; then
rm ./tmp/pids/server.pid
fi
exec bundle exec "$@"
fi