Skip to content

Commit

Permalink
🏗 Build and publish docker image (#2686)
Browse files Browse the repository at this point in the history
* Adds CD builder action

* Fixes apt source lists moved to archive.debian.org

* Adds base and production settings

* Uses development env
  • Loading branch information
mrharpo authored Nov 28, 2023
1 parent d350941 commit 510a75e
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 3 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/CD.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: 🪂 Deploy

on:
push:
branches:
- master
pull_request:
branches:
- master
release:
types: [published, edited, prereleased]
workflow_dispatch:

jobs:
build:
name: 🔨 Build and deploy docker image
uses: WGBH-MLA/.github/.github/workflows/build.yml@main
with:
target: production
19 changes: 17 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
FROM ruby:2.4.4
FROM ruby:2.4.4 as base
WORKDIR /usr/src/app

RUN apt update && apt install -y nodejs curl libcurl3 libcurl3-openssl-dev openjdk-8-jdk && apt-get clean
RUN /bin/echo -e "deb http://archive.debian.org/debian stretch main\ndeb http://archive.debian.org/debian-security stretch/updates main\n" > /etc/apt/sources.list

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

COPY Gemfile Gemfile.lock ./

Expand All @@ -10,3 +12,16 @@ RUN bundle install
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

FROM base as production

RUN apt-get autoremove -y \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*


COPY . .

RUN rake jetty:clean && rake jetty:config

CMD rake jetty:start && bundle exec rake db:migrate RAILS_ENV=development && bundle exec rails s -b 0.0.0.0
2 changes: 1 addition & 1 deletion aapb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ COMMANDS:\n\n
DOCKER_RUN="docker run -it --rm --name aapb"
DOCKER_EXEC="docker exec -it"
VOLUME_MOUNT="-v $(pwd):/usr/src/app/"
PORT_MOUNT="-p 3000:3000"
PORT_MOUNT="-p 3000:3000 -p 8983:8983"

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

0 comments on commit 510a75e

Please sign in to comment.