-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add docker-compose based development environment
- Loading branch information
1 parent
f6d4a54
commit e894897
Showing
6 changed files
with
73 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,3 +45,4 @@ locale/*/software.po.time_stamp | |
vendor/ | ||
|
||
.byebug_history | ||
docker-compose.override.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,46 @@ | ||
FROM opensuse/leap:15.2 | ||
ARG IMAGE_USERID | ||
|
||
# Update distro | ||
RUN zypper -q --non-interactive update | ||
|
||
# Install some system requirements | ||
RUN zypper -q --non-interactive install timezone vim aaa_base glibc-locale sudo nodejs | ||
|
||
# Install ruby | ||
RUN zypper -q --non-interactive install ruby2.5 ruby2.5-devel | ||
|
||
# Setup gem & sudo | ||
FROM registry.opensuse.org/opensuse/leap:15.3 | ||
ARG CONTAINER_USERID | ||
|
||
# Install our requirements | ||
RUN zypper -n ar -f \ | ||
https://download.opensuse.org/repositories/devel:/languages:/ruby/openSUSE_Leap_15.3/devel:languages:ruby.repo; \ | ||
zypper -n --gpg-auto-import-keys refresh; \ | ||
zypper -n install --no-recommends timezone glibc-locale sudo \ | ||
vim git-core \ | ||
gcc gcc-c++ make \ | ||
nodejs16 ruby3.1-devel \ | ||
libxml2-devel libxslt-devel | ||
|
||
# Setup ruby in PATH & sudo | ||
RUN echo 'install: --no-format-executable' >> /etc/gemrc; \ | ||
echo 'vagrant ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers | ||
|
||
# Install bundler | ||
RUN gem install bundler | ||
|
||
# Install requirements for our rubygems | ||
RUN zypper -q --non-interactive install --no-recommends sqlite3-devel gcc gcc-c++ make libxml2-devel libxslt-devel git-core | ||
echo 'software ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers; \ | ||
ln -s /usr/bin/gem.ruby3.1 /usr/local/bin/gem; \ | ||
ln -s /usr/bin/ruby.ruby3.1 /usr/local/bin/ruby; \ | ||
ln -s /usr/bin/bundle.ruby3.1 /usr/local/bin/bundle; \ | ||
ln -s /usr/bin/bundler.ruby3.1 /usr/local/bin/bundler; \ | ||
ln -s /usr/bin/irb.ruby3.1 /usr/local/bin/irb; \ | ||
ln -s /usr/bin/rake.ruby3.1 /usr/local/bin/rake | ||
|
||
# Add our user | ||
RUN useradd -m vagrant -u $IMAGE_USERID -p vagrant | ||
RUN useradd -m software -u $CONTAINER_USERID -p software | ||
|
||
# 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. | ||
ADD Gemfile /software/Gemfile | ||
ADD Gemfile.lock /software/Gemfile.lock | ||
RUN chown -R software /software | ||
|
||
USER vagrant | ||
WORKDIR /vagrant | ||
USER software | ||
WORKDIR /software | ||
|
||
# Setup bundler | ||
RUN bundle config build.nokogiri --use-system-libraries | ||
|
||
# Refresh our bundle | ||
RUN bundle install --jobs=3 --retry=3 | ||
|
||
# Run our command | ||
CMD ["rails", "server", "-b", "0.0.0.0"] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
version: '2.1' | ||
services: | ||
software: | ||
build: | ||
args: | ||
CONTAINER_USERID: 1000 | ||
environment: | ||
- API_USERNAME=yourusername | ||
- API_PASSWORD=password123 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
version: "2.1" | ||
services: | ||
memcached: | ||
image: registry.opensuse.org/opensuse/memcached:latest | ||
software: | ||
build: | ||
dockerfile: Dockerfile | ||
context: . | ||
args: | ||
CONTAINER_USERID: 1000 | ||
command: bundle exec rails s -b 0.0.0.0 | ||
volumes: | ||
- .:/software | ||
ports: | ||
- "3000:3000" | ||
depends_on: | ||
- memcached | ||
environment: | ||
- MEMCACHED_HOST="memcached:11211" |