From 5ea1c8c186d7c634580efcb07dea5bce8bbb3305 Mon Sep 17 00:00:00 2001 From: Han Date: Wed, 12 Jun 2024 23:13:08 +0100 Subject: [PATCH] . --- .github/workflows/test-in-herokuish.yml | 37 +++++++++++++------------ Dockerfile.test | 10 ++++--- 2 files changed, 25 insertions(+), 22 deletions(-) diff --git a/.github/workflows/test-in-herokuish.yml b/.github/workflows/test-in-herokuish.yml index fdf108a5..a4606d31 100644 --- a/.github/workflows/test-in-herokuish.yml +++ b/.github/workflows/test-in-herokuish.yml @@ -87,8 +87,8 @@ jobs: context: . tags: ghcr.io/wearefuturegov/outpost:test file: Dockerfile.test - # load: true - push: true + load: true + # push: true build-args: | NODE_OPTIONS=--openssl-legacy-provider RAILS_ENV=test @@ -98,22 +98,23 @@ jobs: # run: | # docker run --rm outpost:test - # - name: Run the image and tests - # run: | - # docker run -d --name test_container \ - # --network $test_network_name \ - # -p 3000:3000 \ - # -e RAILS_ENV=test \ - # -e NODE_ENV=development \ - # -e RAILS_SERVE_STATIC_FILES=true \ - # -e DB_URI=$test_mongo_internal_db_uri \ - # -e DATABASE_URL=$test_postgres_internal_db_uri \ - # -e GOOGLE_API_KEY=${{ secrets.GOOGLE_API_KEY }} \ - # -e OFSTED_FEED_API_ENDPOINT=https://test-ofsted-feed.stub \ - # outpost:test - # docker exec test_container /exec bin/bundle exec rspec - - # docker exec temp_container /bin/herokuish procfile exec bin/bundle exec rails assets:precompile + - name: Run the image and tests + run: | + docker run --rm --name test_container \ + --network $test_network_name \ + -p 3000:3000 \ + -e RAILS_ENV=test \ + -e NODE_ENV=development \ + -e RAILS_SERVE_STATIC_FILES=true \ + -e DB_URI=$test_mongo_internal_db_uri \ + -e DATABASE_URL=$test_postgres_internal_db_uri \ + -e GOOGLE_API_KEY=${{ secrets.GOOGLE_API_KEY }} \ + -e OFSTED_FEED_API_ENDPOINT=https://test-ofsted-feed.stub \ + outpost:test + +# docker exec test_container /exec bin/bundle exec rspec + +# docker exec temp_container /bin/herokuish procfile exec bin/bundle exec rails assets:precompile # @TODO fix static files not generating in this image # name: Run tests in herokuish diff --git a/Dockerfile.test b/Dockerfile.test index 95db4410..f8d534e7 100644 --- a/Dockerfile.test +++ b/Dockerfile.test @@ -8,8 +8,7 @@ ARG RAILS_ENV=test # generate slug as app.tar.gz # ------------ FROM --platform=linux/amd64 gliderlabs/herokuish:latest-${STACK_VERSION} -WORKDIR /tmp/app -COPY ./app.json /tmp +COPY . /tmp/app ARG NODE_ENV ARG RAILS_ENV @@ -24,6 +23,9 @@ RUN (cat /tmp/app.json || echo '{}') | jq -r '.environments.test.buildpacks[].ur RUN while IFS= read -r line; do herokuish buildpack install "$line"; done < /tmp/app/.buildpacks +RUN /build && \ + rm -Rf /tmp/* + RUN apt-get update --error-on=any @@ -88,5 +90,5 @@ RUN echo $RAILS_ENV RUN echo $NODE_ENV RUN echo $RAILS_SERVE_STATIC_FILES -ENTRYPOINT [ "/bin/herokuish" ] -CMD [ "buildpack", "test" ] \ No newline at end of file +ENTRYPOINT [ "/exec" ] +CMD [ "bin/bundle", "exec", "rspec" ] \ No newline at end of file