Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
4
21 changes: 21 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM node:alpine

# Install dependencies
RUN apk --no-cache update && apk add --no-cache npm

# Add /app/node_modules/.bin to $PATH
ENV PATH /app/node_modules/.bin:$PATH

# Create our app filesystem tree
RUN mkdir -p /app/node_modules/.cache /app/chrome /app/css /app/dist /app/example /app/lib /app/views

WORKDIR /app

# Copy app code into container in /data
COPY --chown=root:root . /app/

RUN rm -f Dockerfile LICENSE README.md build.sh

RUN npm install

CMD ["/app/entrypoint.sh"]
35 changes: 35 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash

build_no="$1"
build_args="--compress"

if [ -z "$build_no" ]; then
echo "Usage: $0 <build number>"
exit 1
fi
tag1="registry.library.oregonstate.edu/researchdeck:osulp-${build_no}"
latest=`echo $tag1 | sed -e "s/:osulp-${build_no}/:latest/"`

echo "Building for tag $tag1"
docker build ${build_args} . -t "$tag1"

if [ "$?" -ne 0 ]; then
echo "Build for $tag1 failed"
exit 1
fi

echo "Logging into BCR as admin"
echo admin | docker login --password-stdin registry.library.oregonstate.edu

echo "pushing: $tag1"
docker push "$tag1"

if [ "$?" -ne 0 ]; then
echo "Push of $tag1 failed"
exit 1
fi

echo "Updating :latest tag to :osulp-${build_no}"
docker tag $tag1 $latest
docker push "$latest"
echo "$build_no" > .version
26 changes: 26 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/sh

sleep_secs=300

timestamp=`date +'%Y-%m-%d %H:%M:%S'`
echo "[$timestamp]: Starting researchdeck initialization"

# Start app
#timestamp=`date +'%Y-%m-%d %H:%M:%S'`
#echo "[$timestamp]: Starting Rails ($RAILS_ENV)"
#/usr/local/bin/bundle exec puma -C /data/config/puma/${RAILS_ENV}.rb


# Sleep loop
# Every $sleep_secs seconds, display the number of non-shell processes,
# the PID of postmaster and the handle server and number of established
# connections
sleep 5
while `true`; do
timestamp=`date +'%Y-%m-%d %H:%M:%S'`
nproc=`ps ax | grep -v grep | grep -v bash | wc -l`
estab=`netstat -an | grep ESTAB | grep -v grep | wc -l`

echo "[$timestamp] nproc=$nproc conn=$estab"
sleep $sleep_secs
done
Loading