6.0.0-0-ol-7-r0 release

This commit is contained in:
Bitnami Bot 2019-09-05 12:13:44 +00:00
parent e3d32914b2
commit d398afee69
4 changed files with 152 additions and 1 deletions

View File

@ -0,0 +1,24 @@
FROM bitnami/oraclelinux-extras:7-r451
LABEL maintainer "Bitnami <containers@bitnami.com>"
# Install required system packages and dependencies
RUN install_packages bzip2-libs ca-certificates cyrus-sasl-lib gcc-c++ glibc keyutils-libs krb5-libs libcom_err libcurl libgcc libidn libselinux libssh2 libstdc++ libxml2 make mysql-devel nc ncurses-libs nspr nss nss-softokn-freebl nss-util openldap openssl-libs pcre pkgconfig readline sqlite zlib
RUN bitnami-pkg install ruby-2.6.4-0 --checksum 8774fa00c7fbf9bd5e8af4425f20c466c606c9bdf2df4aee80db525bbd45ab49
RUN bitnami-pkg install node-10.16.3-0 --checksum 6d1e5c1738ca06f510ce68bb537b84340dd22871b4cca281df65198f5964ea4a
RUN bitnami-pkg install mysql-client-10.3.17-0 --checksum 83fd01acb88a54d028a327870cec66bf43f57f326814a16dc4626a5171742229
RUN bitnami-pkg install git-2.23.0-0 --checksum 30618c63e72727b90b3cc3e7f8747e599ec11352b29812285a27029807d8766d
RUN bitnami-pkg install rails-6.0.0-0-0 --checksum 678862f7a25958ae8575b6540358f6127b08df59ca179ffbb38ff3fcd65041a9
RUN mkdir /app && chown bitnami:bitnami /app
COPY rootfs /
ENV BITNAMI_APP_NAME="rails" \
BITNAMI_IMAGE_VERSION="6.0.0-0-ol-7-r0" \
PATH="/opt/bitnami/ruby/bin:/opt/bitnami/node/bin:/opt/bitnami/mysql/bin:/opt/bitnami/git/bin:/opt/bitnami/rails/bin:$PATH" \
RAILS_ENV="development"
EXPOSE 3000
WORKDIR /app
USER bitnami
ENTRYPOINT [ "/app-entrypoint.sh" ]
CMD [ "bundle", "exec", "rails", "server", "-b", "0.0.0.0", "-p", "3000" ]

View File

@ -0,0 +1,20 @@
version: '2'
services:
mariadb:
image: 'bitnami/mariadb:10.3-ol-7'
environment:
- ALLOW_EMPTY_PASSWORD=yes
myapp:
tty: true # Enables debugging capabilities when attached to this container.
image: bitnami/rails:6-ol-7
environment:
- DATABASE_HOST=mariadb
- DATABASE_NAME=my_app_development
depends_on:
- mariadb
ports:
- 3000:3000
volumes:
- .:/app

View File

@ -0,0 +1,107 @@
#!/bin/bash
set -o errexit
set -o pipefail
# set -o xtrace
# shellcheck disable=SC1091
# Load libraries
. /opt/bitnami/base/functions
# Constants
INIT_SEM=/tmp/initialized.sem
# Functions
########################
# Ensure gems are up to date
# Arguments:
# None
# Returns:
# Boolean
#########################
gems_up_to_date() {
bundle check 1> /dev/null
}
########################
# Wait for database to be ready
# Globals:
# DATABASE_HOST
# Arguments:
# None
# Returns:
# None
#########################
wait_for_db() {
local db_host="${DATABASE_HOST:-mariadb}"
local db_address
db_address="$(getent hosts "$db_host" | awk '{ print $1 }')"
counter=0
log "Connecting to MariaDB at $db_address"
while ! nc -z "$db_host" 3306; do
counter=$((counter+1))
if [ $counter == 30 ]; then
log "Error: Couldn't connect to MariaDB."
exit 1
fi
log "Trying to connect to mariadb at $db_address. Attempt $counter."
sleep 5
done
}
print_welcome_page
if [[ "$1" = "bundle" ]] && [[ "$2" = "exec" ]]; then
if [[ -f /app/config.ru ]]; then
log "Rails project found. Skipping creation..."
else
log "Creating new Rails project..."
rails new . --skip-bundle --database mysql
# Add mini_racer
sed -i -e "s/# gem 'mini_racer'/gem 'mini_racer'/" Gemfile
# TODO: substitution using 'yq' once they support anchors
# Related issue: https://github.com/mikefarah/yq/issues/178
# E.g: yq w -i /app/config/database.yml default.host '<%= ENV.fetch("DATABASE_HOST") { mariadb } %>'
# E.g: yq w -i /app/config/database.yml development.database '<%= ENV.fetch("DATABASE_NAME") { mariadb } %>'
log "Setting default host to \`${DATABASE_HOST:-mariadb}\`..."
sed -i -e 's/host:.*$/host: <%= ENV.fetch("DATABASE_HOST", "mariadb") %>/g' /app/config/database.yml
log "Setting development database to \`${DATABASE_NAME:-my_app_development}\`..."
sed -i -e '1,/test:/ s/database:.*$/database: <%= ENV.fetch("DATABASE_NAME", "my_app_development") %>/g' /app/config/database.yml
fi
if ! gems_up_to_date; then
log "Installing/Updating Rails dependencies (gems)..."
bundle install
log "Gems updated!!"
fi
if [[ -z $SKIP_DB_WAIT ]]; then
wait_for_db
fi
if [[ -f $INIT_SEM ]]; then
echo "#########################################################################"
echo " "
echo " App initialization skipped:"
echo " Delete the file $INIT_SEM and restart the container to reinitialize"
echo " You can alternatively run specific commands using docker-compose exec"
echo " e.g docker-compose exec rails bundle exec rails db:migrate"
echo " "
echo "#########################################################################"
else
if [[ -z $SKIP_DB_SETUP ]]; then
log "Configuring the database..."
bundle exec rails db:create
fi
log "Initialization finished!!!"
touch $INIT_SEM
fi
if [[ -z $SKIP_DB_SETUP ]]; then
log "Applying database migrations (db:migrate)..."
bundle exec rails db:migrate
fi
fi
exec tini -- "$@"

View File

@ -42,8 +42,8 @@ $ kubectl apply -f test.yaml
Learn more about the Bitnami tagging policy and the difference between rolling tags and immutable tags [in our documentation page](https://docs.bitnami.com/containers/how-to/understand-rolling-tags-containers/).
* [`6-ol-7`, `6.0.0-0-ol-7-r0` (6/ol-7/Dockerfile)](https://github.com/bitnami/bitnami-docker-rails/blob/6.0.0-0-ol-7-r0/6/ol-7/Dockerfile)
* [`6-debian-9`, `6.0.0-0-debian-9-r0`, `6`, `6.0.0-0`, `6.0.0-0-r0`, `latest` (6/debian-9/Dockerfile)](https://github.com/bitnami/bitnami-docker-rails/blob/6.0.0-0-debian-9-r0/6/debian-9/Dockerfile)
* [`6-ol-7`, `0.0.0-0-ol-7-r0` (6/ol-7/Dockerfile)](https://github.com/bitnami/bitnami-docker-rails/blob/0.0.0-0-ol-7-r0/6/ol-7/Dockerfile)
Subscribe to project updates by watching the [bitnami/rails GitHub repo](https://github.com/bitnami/bitnami-docker-rails).