6.0.0-0-debian-9-r0 release
This commit is contained in:
parent
c0980ff29f
commit
e3d32914b2
|
|
@ -0,0 +1,24 @@
|
|||
FROM bitnami/minideb-extras:stretch-r470
|
||||
LABEL maintainer "Bitnami <containers@bitnami.com>"
|
||||
|
||||
# Install required system packages and dependencies
|
||||
RUN install_packages build-essential default-libmysqlclient-dev ghostscript imagemagick libbz2-1.0 libc6 libcomerr2 libcurl3 libffi6 libgcc1 libgcrypt20 libgmp-dev libgmp10 libgnutls30 libgpg-error0 libgssapi-krb5-2 libhogweed4 libidn11 libidn2-0 libk5crypto3 libkeyutils1 libkrb5-3 libkrb5support0 libldap-2.4-2 libncurses5 libnettle6 libnghttp2-14 libp11-kit0 libpq5 libpsl5 libreadline-dev libreadline7 librtmp1 libsasl2-2 libsqlite3-0 libssh2-1 libssl1.0.2 libssl1.1 libstdc++6 libtasn1-6 libtinfo5 libunistring0 libxml2-dev libxslt1-dev netcat-traditional zlib1g zlib1g-dev
|
||||
RUN bitnami-pkg install ruby-2.6.4-0 --checksum d3850ff8359e897e10fd224371b34a5334e3f2ae1f79a73ab138d74987d61a72
|
||||
RUN bitnami-pkg install node-10.16.3-0 --checksum 6c6466b1645568da237ba1bb079a52ca5661aedcf04d832728890b78a3e48689
|
||||
RUN bitnami-pkg install mysql-client-10.3.17-0 --checksum 71d59fafc3e7e3e598af0c2b6788d77558630afe647ec1f922ffdd5025f3d737
|
||||
RUN bitnami-pkg install git-2.23.0-0 --checksum 54731b0fecdf38ab559cdd76311a229915bf0581b213a5806d3c7d56c5399981
|
||||
RUN bitnami-pkg install rails-6.0.0-0-0 --checksum 1b3be0d532e8c4e04e085d5a7575a364ae348dcdbb84914ab3bbd56da8b896e4
|
||||
RUN mkdir /app && chown bitnami:bitnami /app
|
||||
|
||||
COPY rootfs /
|
||||
ENV BITNAMI_APP_NAME="rails" \
|
||||
BITNAMI_IMAGE_VERSION="6.0.0-0-debian-9-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" ]
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
version: '2'
|
||||
services:
|
||||
mariadb:
|
||||
image: 'bitnami/mariadb:10.3'
|
||||
environment:
|
||||
- ALLOW_EMPTY_PASSWORD=yes
|
||||
|
||||
myapp:
|
||||
tty: true # Enables debugging capabilities when attached to this container.
|
||||
image: bitnami/rails:6
|
||||
environment:
|
||||
- DATABASE_HOST=mariadb
|
||||
- DATABASE_NAME=my_app_development
|
||||
depends_on:
|
||||
- mariadb
|
||||
ports:
|
||||
- 3000:3000
|
||||
volumes:
|
||||
- .:/app
|
||||
|
|
@ -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 -- "$@"
|
||||
|
|
@ -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/).
|
||||
|
||||
|
||||
* [`5-ol-7`, `5.2.3-0-ol-7-r132` (5/ol-7/Dockerfile)](https://github.com/bitnami/bitnami-docker-rails/blob/5.2.3-0-ol-7-r132/5/ol-7/Dockerfile)
|
||||
* [`5-debian-9`, `5.2.3-0-debian-9-r121`, `5`, `5.2.3-0`, `5.2.3-0-r121`, `latest` (5/debian-9/Dockerfile)](https://github.com/bitnami/bitnami-docker-rails/blob/5.2.3-0-debian-9-r121/5/debian-9/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).
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ services:
|
|||
|
||||
myapp:
|
||||
tty: true # Enables debugging capabilities when attached to this container.
|
||||
image: bitnami/rails:5
|
||||
image: bitnami/rails:6
|
||||
environment:
|
||||
- DATABASE_HOST=mariadb
|
||||
- DATABASE_NAME=my_app_development
|
||||
|
|
|
|||
Loading…
Reference in New Issue