diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c0339be7..e95af49c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -27,14 +27,19 @@ based development environment, based on [docker](https://www.docker.com/) and [docker-compose](https://docs.docker.com/compose/). Here's a step by step guide how to set it up. -1. Set up the development environment: - ```bash - docker-compose run --rm osem bundle exec rake setup:bootstrap - ``` +**WARNING**: Since we mount the repository into our container, your user id and +the id of the osem user inside the container need to be the same. If your user +id (`id -u`) is something **other** than `1000` you can copy the docker-compose +override example file and in it, set your user id in the variable +*CONTAINER_USERID*. -1. Start the development environment: +```bash +cp docker-compose.override.yml.example docker-compose.override.yml +``` + +1. Start the development environment¹: ```bash - docker-compose up --build + docker-compose up ``` 1. Check out your OSEM rails app. You can access the app at http://localhost:3000. Whatever you change in your cloned repository will have effect in the development environment. Sign up, the first user will be automatically assigned the admin role. @@ -54,13 +59,6 @@ how to set it up. docker-compose exec osem_1 /bin/bash -l ``` -**WARNING**: Since we mount the repository into our container, your user id and the id of the osem user inside the container need to be the same. If your user id (`id -u`) is something else than `1000` you can copy the docker-compose override example file and in it, set your user id in the variable -*CONTAINER_USERID*. - -```bash -cp docker-compose.override.yml.example docker-compose.override.yml -``` - ### with Vagrant Another option is using [Vagrant](https://www.vagrantup.com/) and [VirtualBox 5.0.10](https://www.virtualbox.org/wiki/Download_Old_Builds_5_0) to create your development environment. diff --git a/Dockerfile b/Dockerfile index 0b36037d..3cb7e293 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,19 +4,8 @@ ARG CONTAINER_USERID # Configure our user RUN usermod -u $CONTAINER_USERID osem -# We copy the Gemfiles into this intermediate build stage so it's checksum -# changes and all the subsequent stages (a.k.a. the bundle install call below) -# have to be rebuild. Otherwise, after the first build of this image, -# docker would use it's cache for this and the following stages. -COPY Gemfile /osem/ -COPY Gemfile.lock /osem/ -RUN chown -R osem /osem - -# Add our files USER osem WORKDIR /osem/ -# Install our bundle -RUN export NOKOGIRI_USE_SYSTEM_LIBRARIES=1; bundle install --jobs=3 --retry=3 +CMD ["/osem/bin/osem-init.sh"] -CMD ["foreman", "start"] diff --git a/bin/osem-init.sh b/bin/osem-init.sh index 3b03cd20..5e26965b 100755 --- a/bin/osem-init.sh +++ b/bin/osem-init.sh @@ -1,3 +1,9 @@ #!/bin/bash +# Configure our bundle +export NOKOGIRI_USE_SYSTEM_LIBRARIES=1 +# Install our bundle if it's outdated +bundle check || bundle install --jobs=3 --retry=3 +# Setup the app if it isn't already setup bundle exec rake setup:bootstrap +# Start the app foreman start