-
-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make it directly usable in Docker #1336
base: develop
Are you sure you want to change the base?
Changes from all commits
92a3ade
38423a8
14834c4
b482d6d
ad70f03
f42a836
d553a6d
61e920d
58514ad
8a98e82
c703d06
00bb197
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,12 @@ | ||
FROM ruby:3.0.0 | ||
|
||
# docker build -f docker/Dockerfile -t qpixel_uwsgi . | ||
FROM ruby:3.1.0 | ||
|
||
ENV RUBYOPT="-KU -E utf-8:utf-8" | ||
RUN apt-get update && \ | ||
apt-get install -y gcc && \ | ||
apt-get install -y make && \ | ||
apt-get install -y \ | ||
default-libmysqlclient-dev \ | ||
autoconf \ | ||
autoconf \ | ||
bison \ | ||
build-essential \ | ||
libssl-dev \ | ||
|
@@ -17,27 +15,21 @@ RUN apt-get update && \ | |
zlib1g-dev \ | ||
libncurses5-dev \ | ||
libffi-dev \ | ||
libgdbm-dev && \ | ||
apt-get install -y default-mysql-server | ||
|
||
# Install nodejs and imagemagick | ||
WORKDIR /opt | ||
RUN wget https://nodejs.org/dist/v12.18.3/node-v12.18.3-linux-x64.tar.xz && \ | ||
tar xf node-v12.18.3-linux-x64.tar.xz && \ | ||
wget https://imagemagick.org/archive/binaries/magick && \ | ||
chmod +x magick && \ | ||
mv magick /usr/local/bin/magick | ||
|
||
ENV NODEJS_HOME=/opt/node-v12.18.3-linux-x64/bin | ||
ENV PATH=$NODEJS_HOME:$PATH | ||
libgdbm-dev \ | ||
nodejs \ | ||
node-imagemagick \ | ||
imagemagick | ||
|
||
# Add core code to container | ||
WORKDIR /code | ||
COPY . /code | ||
COPY Gemfile Gemfile.lock /code/ | ||
RUN gem install bundler -v 2.4.22 && \ | ||
bundle install | ||
|
||
COPY . /code | ||
RUN bundle exec rails assets:precompile && \ | ||
chmod -R 0777 /code | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. NB!If anyone decides to port this change, please note that we do not have (yet) a separate Dockerfile for development and precompiled assets are not excluded from git tracking via |
||
|
||
EXPOSE 80 443 3000 | ||
ENTRYPOINT ["/bin/bash"] | ||
CMD ["/code/docker/entrypoint.sh"] | ||
|
||
CMD ["/code/docker/entrypoint.sh"] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,23 @@ | ||
#!/bin/bash | ||
|
||
# If not created yet | ||
if [ ! -f "/db-created" ]; then | ||
if [ ! -f "/tmp/db-created" ]; then | ||
echo "Creating database" | ||
rails db:create | ||
rails db:schema:load | ||
rails r db/scripts/create_tags_path_view.rb | ||
echo "Migrating database" | ||
rails db:migrate | ||
rails db:migrate RAILS_ENV=development | ||
rails r db/scripts/create_tags_path_view.rb | ||
echo "Creating community" | ||
rails r docker/create_admin_and_community.rb | ||
echo "Seeding database" | ||
UPDATE_POSTS=true rails db:seed | ||
touch /db-created | ||
touch /tmp/db-created | ||
fi | ||
|
||
# If this isn't done again, there is a 500 error on the first page about posts | ||
echo "Seeding database" | ||
rails db:seed | ||
|
||
# defaults to port 3000 | ||
echo "Starting server 0.0.0.0:3000" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. NB!If anyone decides to port this change, do note that the port is configurable, so without making it a variable, this will likely report an incorrect port (I have qpixel running on 3014 myself, for example). |
||
rails server -b 0.0.0.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NB!
If anyone decides to port this change, please, review that the Node.js version pulled is compatible or, better, yet, fix it to a specific version range (as we should do with all other dependencies, tbh).