From 510a75ea5747e4a9bc73c6e1a21c8b5ddb70c239 Mon Sep 17 00:00:00 2001 From: Harpo Date: Tue, 28 Nov 2023 07:50:28 -0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=8F=97=20Build=20and=20publish=20docker?= =?UTF-8?q?=20image=20(#2686)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Adds CD builder action * Fixes apt source lists moved to archive.debian.org * Adds base and production settings * Uses development env --- .github/workflows/CD.yml | 19 +++++++++++++++++++ Dockerfile | 19 +++++++++++++++++-- aapb | 2 +- 3 files changed, 37 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/CD.yml diff --git a/.github/workflows/CD.yml b/.github/workflows/CD.yml new file mode 100644 index 0000000000..59ba4f460c --- /dev/null +++ b/.github/workflows/CD.yml @@ -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 diff --git a/Dockerfile b/Dockerfile index e5c3f8ff47..f1567eab4d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 ./ @@ -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 diff --git a/aapb b/aapb index 77ba435fb3..a0d9b87ebe 100755 --- a/aapb +++ b/aapb @@ -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