Unified docker image for BIM edition. Add pre/post hooks for other platforms. (#8553)
Unified docker image for BIM edition. Add pre/post hooks for other platforms.pull/8576/head
parent
a456537fe2
commit
dfbfe24d0b
@ -1,23 +0,0 @@ |
||||
#!/bin/bash |
||||
set -e |
||||
|
||||
pushd "${APP_PATH}/frontend" |
||||
|
||||
export NG_CLI_ANALYTICS=ci # so angular cli doesn't block waiting for user input |
||||
|
||||
# Installing frontend dependencies |
||||
RAILS_ENV=production npm install |
||||
|
||||
popd |
||||
|
||||
# Bundle assets |
||||
DATABASE_URL='nulldb://nohost' RAILS_ENV=production bundle exec rake assets:precompile |
||||
|
||||
# Remove sprockets cache |
||||
rm -rf "$APP_PATH/tmp/cache/assets" |
||||
|
||||
# Remove node_modules and entire frontend |
||||
rm -rf "$APP_PATH/node_modules/" "$APP_PATH/frontend/node_modules/" |
||||
|
||||
# Clean cache in root |
||||
rm -rf /root/.npm |
@ -0,0 +1,59 @@ |
||||
#!/bin/bash |
||||
|
||||
set -e |
||||
|
||||
display_error() { |
||||
echo " !--> ERROR on postinstall:" |
||||
tail -n 200 /tmp/dockerize.log |
||||
exit 1 |
||||
} |
||||
|
||||
echo " ---> POSTINSTALL" |
||||
|
||||
# Add MySQL-to-Postgres migration script to path (used in entrypoint.sh) |
||||
cp ./docker/mysql-to-postgres/bin/migrate-mysql-to-postgres /usr/local/bin/ |
||||
|
||||
# Ensure we can write in /tmp/op_uploaded_files (cf. #29112) |
||||
mkdir -p /tmp/op_uploaded_files/ && chown -R $APP_USER:$APP_USER /tmp/op_uploaded_files/ |
||||
|
||||
rm -f ./config/database.yml |
||||
|
||||
if test -f ./docker/setup/postinstall-$PLATFORM.sh ; then |
||||
echo " ---> Executing postinstall for $PLATFORM..." |
||||
./docker/setup/postinstall-$PLATFORM.sh |
||||
fi |
||||
|
||||
echo " ---> Precompiling assets. This will take a while..." |
||||
|
||||
( |
||||
pushd "${APP_PATH}/frontend" |
||||
|
||||
export NG_CLI_ANALYTICS=ci # so angular cli doesn't block waiting for user input |
||||
|
||||
# Installing frontend dependencies |
||||
RAILS_ENV=production npm install |
||||
|
||||
popd |
||||
|
||||
# Bundle assets |
||||
su - postgres -c "$PGBIN/initdb -D /tmp/nulldb" |
||||
su - postgres -c "$PGBIN/pg_ctl -D /tmp/nulldb -l /dev/null -w start" |
||||
echo "create database assets; create user assets with encrypted password 'p4ssw0rd'; grant all privileges on database assets to assets;" | su - postgres -c psql |
||||
DATABASE_URL=postgres://assets:p4ssw0rd@127.0.0.1/assets RAILS_ENV=production bundle exec rake db:migrate db:schema:dump db:schema:cache:dump assets:precompile |
||||
|
||||
su - postgres -c "$PGBIN/pg_ctl -D /tmp/nulldb stop" |
||||
|
||||
rm -rf /tmp/nulldb |
||||
|
||||
# Remove sprockets cache |
||||
rm -rf "$APP_PATH/tmp/cache/assets" |
||||
|
||||
# Remove node_modules and entire frontend |
||||
rm -rf "$APP_PATH/node_modules/" "$APP_PATH/frontend/node_modules/" |
||||
|
||||
# Clean cache in root |
||||
rm -rf /root/.npm |
||||
) >/tmp/dockerize.log || display_error |
||||
|
||||
rm -f /tmp/dockerize.log |
||||
echo " OK." |
@ -0,0 +1,11 @@ |
||||
#!/bin/bash |
||||
set -e |
||||
|
||||
apt-get install -y \ |
||||
memcached \ |
||||
postfix \ |
||||
apache2 \ |
||||
supervisor |
||||
|
||||
a2enmod proxy proxy_http |
||||
rm -f /etc/apache2/sites-enabled/000-default.conf |
@ -0,0 +1,82 @@ |
||||
#!/bin/bash |
||||
set -e |
||||
|
||||
echo " ---> PREINSTALL" |
||||
|
||||
display_error() { |
||||
echo " !--> ERROR on preinstall:" |
||||
tail -n 200 /tmp/dockerize.log |
||||
exit 1 |
||||
} |
||||
|
||||
echo " ---> Setting up common dependencies. This will take a while..." |
||||
apt-get update -qq |
||||
|
||||
( |
||||
# install node + npm |
||||
curl -s https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-x64.tar.gz | \ |
||||
tar xzf - -C /usr/local --strip-components=1 |
||||
|
||||
apt-get install -y \ |
||||
apt-transport-https \ |
||||
postgresql-client \ |
||||
pandoc \ |
||||
poppler-utils \ |
||||
unrtf \ |
||||
tesseract-ocr \ |
||||
catdoc \ |
||||
postgresql |
||||
|
||||
# Set up pg defaults |
||||
echo "host all all 0.0.0.0/0 md5" >> /etc/postgresql/9.6/main/pg_hba.conf |
||||
echo "listen_addresses='*'" >> /etc/postgresql/9.6/main/postgresql.conf |
||||
echo "data_directory='$PGDATA'" >> /etc/postgresql/9.6/main/postgresql.conf |
||||
rm -rf "$PGDATA_LEGACY" && rm -rf "$PGDATA" && mkdir -p "$PGDATA" && chown -R postgres:postgres "$PGDATA" |
||||
|
||||
# Specifics for BIM edition |
||||
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | apt-key add - |
||||
wget -q https://packages.microsoft.com/config/debian/9/prod.list -O /etc/apt/sources.list.d/microsoft-prod.list |
||||
apt-get update -qq |
||||
apt-get install -y dotnet-runtime-3.1 |
||||
|
||||
tmpdir=$(mktemp -d) |
||||
cd $tmpdir |
||||
|
||||
# Install XKT converter |
||||
npm install xeokit/xeokit-gltf-to-xkt -g |
||||
|
||||
# Install COLLADA2GLTF |
||||
wget --quiet https://github.com/KhronosGroup/COLLADA2GLTF/releases/download/v2.1.5/COLLADA2GLTF-v2.1.5-linux.zip |
||||
unzip -q COLLADA2GLTF-v2.1.5-linux.zip |
||||
mv COLLADA2GLTF-bin "/usr/local/bin/COLLADA2GLTF" |
||||
|
||||
# IFCconvert |
||||
wget --quiet https://s3.amazonaws.com/ifcopenshell-builds/IfcConvert-v0.6.0-9bcd932-linux64.zip |
||||
unzip -q IfcConvert-v0.6.0-9bcd932-linux64.zip |
||||
mv IfcConvert "/usr/local/bin/IfcConvert" |
||||
|
||||
wget --quiet https://github.com/bimspot/xeokit-metadata/releases/download/1.0.0/xeokit-metadata-linux-x64.tar.gz |
||||
tar -zxvf xeokit-metadata-linux-x64.tar.gz |
||||
chmod +x xeokit-metadata-linux-x64/xeokit-metadata |
||||
cp -r xeokit-metadata-linux-x64/ "/usr/lib/xeokit-metadata" |
||||
ln -s /usr/lib/xeokit-metadata/xeokit-metadata /usr/local/bin/xeokit-metadata |
||||
|
||||
cd / |
||||
rm -rf $tmpdir |
||||
|
||||
gem install bundler --version "$BUNDLER_VERSION" --no-document |
||||
|
||||
useradd -d /home/$APP_USER -m $APP_USER |
||||
|
||||
) >/tmp/dockerize.log || display_error |
||||
|
||||
if test -f ./docker/setup/preinstall-$PLATFORM.sh ; then |
||||
echo " ---> Executing preinstall for $PLATFORM..." |
||||
./docker/setup/preinstall-$PLATFORM.sh >/tmp/dockerize.log || display_error |
||||
fi |
||||
|
||||
apt-get clean |
||||
rm -rf /var/lib/apt/lists/* |
||||
|
||||
rm -f /tmp/dockerize.log |
||||
echo " OK." |
Loading…
Reference in new issue