Skip to content

Commit

Permalink
Docker (#2423)
Browse files Browse the repository at this point in the history
* added Dockerfile to run dev env

* basic init script with build and dev

* added ./aapb help documentation
  • Loading branch information
mrharpo authored Jul 27, 2022
1 parent 39f76ad commit 8f37fab
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM ruby:2.4.4
WORKDIR /usr/src/app

RUN apt update && apt install -y nodejs curl libcurl3 libcurl3-openssl-dev openjdk-8-jdk && apt-get clean

COPY Gemfile Gemfile.lock ./

RUN bundle install

# COPY . .

EXPOSE 3000

CMD rake jetty:clean && rake jetty:config && rake jetty:start && bundle exec rake db:migrate RAILS_ENV=development && bundle exec rails s -b 0.0.0.0
40 changes: 40 additions & 0 deletions aapb
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/bin/bash
HELP="AAPB init script\n\n
A basic CLI for managing AAPB \n\n
USAGE:\n\n
\t ./aapb COMMAND [args] \n\n
COMMANDS:\n\n
\t b | build \t build the docker image\n
\t c | cmd \t run a bash command with the docker image\n
\t d | dev \t start a development server\n
\t h | help \t prints this help text\n
"

DEV_CMD="docker run -it -p 3000:3000 -v $(pwd):/usr/src/app/ aapb"

if [ -z $1 ]; then
echo -e $HELP

elif [ $1 = "build" -o $1 = "b" ]; then
shift
docker build -t aapb . "$@"

elif [ $1 = "cmd" -o $1 = "c" ]; then
shift
if [ -z $1 ]; then
$DEV_CMD bash
else $DEV_CMD "$@"
fi

elif [ $1 = "dev" -o $1 = "d" ]; then
shift
$DEV_CMD "$@"

else echo -e $HELP

fi

0 comments on commit 8f37fab

Please sign in to comment.