test:
runs-on: [ubuntu-20.04]
needs: base
+ defaults:
+ run:
+ working-directory: image/discourse_test
steps:
- - name: enable experimental docker features
- run: |
- sudo bash -c 'echo "{ \"cgroup-parent\": \"/actions_job\",\"experimental\":true}" > /etc/docker/daemon.json'
- sudo service docker restart
- docker version -f '{{.Server.Experimental}}'
- uses: actions/checkout@v2
with:
fetch-depth: 1
- - name: build discourse_test image
+ - name: build discourse_test:slim
+ run: |
+ docker buildx build . --load \
+ --build-arg from_tag=slim \
+ --target base \
+ --tag discourse/discourse_test:slim
+ - name: build discourse_test:slim-browsers
+ run: |
+ docker buildx build . --load \
+ --build-arg from_tag=slim \
+ --target with_browsers \
+ --tag discourse/discourse_test:slim-browsers
+ - name: build discourse_test:release
+ run: |
+ docker buildx build . --load \
+ --build-arg from_tag=release \
+ --target release \
+ --tag discourse/discourse_test:release
+ - name: Print summary
run: |
- cd image && ruby auto_build.rb discourse_test_public
+ docker images discourse/discourse_test
- name: push to dockerhub
if: success() && (github.ref == 'refs/heads/main')
env:
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
run: |
docker login --username discoursebuild --password $DOCKERHUB_PASSWORD
+ docker push discourse/discourse_test:slim
+ docker push discourse/discourse_test:slim-browsers
docker push discourse/discourse_test:release
dev:
runs-on: [ubuntu-20.04]
base_slim: { name: 'base', tag: "discourse/base:build_slim", squash: true, extra_args: '-f slim.Dockerfile' },
base: { name: 'base', tag: "discourse/base:build", extra_args: '-f release.Dockerfile' },
discourse_test_build: { name: 'discourse_test', tag: "discourse/discourse_test:build", squash: false},
- discourse_test_public: { name: 'discourse_test', tag: "discourse/discourse_test:release", squash: true, extra_args: ' --build-arg tag=release '},
discourse_dev: { name: 'discourse_dev', tag: "discourse/discourse_dev:build", squash: false },
}
-# NAME: discourse/discourse_test
-# VERSION: release
-ARG tag=build
-FROM discourse/base:$tag
+ARG from_tag=build
+
+FROM discourse/base:$from_tag AS base
ENV RAILS_ENV test
-MAINTAINER Sam Saffron "https://twitter.com/samsaffron"
+WORKDIR /var/www/discourse
+ENV LANG en_US.UTF-8
+ENTRYPOINT sudo -E -u discourse -H ruby script/docker_test.rb
# configure Git to suppress warnings
RUN sudo -E -u discourse -H git config --global user.email "you@example.com" &&\
sudo -E -u discourse -H git config --global user.name "Your Name"
-RUN gem update bundler --force &&\
- cd /var/www/discourse &&\
- chown -R discourse . &&\
- bundle config unset deployment &&\
- bundle config unset without &&\
- sudo -u discourse git pull &&\
- sudo -u discourse bundle install --jobs=4
+RUN chown -R discourse . &&\
+ chown -R discourse /var/run/postgresql &&\
+ bundle config unset deployment &&\
+ bundle config unset without
+
+FROM base AS with_browsers
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add - &&\
echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list &&\
apt update &&\
apt install -y libgconf-2-4 libxss1 google-chrome-stable firefox-esr &&\
- npm install -g eslint babel-eslint &&\
cd /tmp && wget "https://download.mozilla.org/?product=firefox-latest-ssl&os=linux64&lang=en-US" -O firefox.tar.bz2 &&\
tar xjvf firefox.tar.bz2 && mv /tmp/firefox /opt/firefox-evergreen &&\
- cd /var/www/discourse && sudo -E -u discourse -H yarn install
+ apt clean
-RUN cd /var/www/discourse && sudo -E -u discourse -H bundle exec rake plugin:install_all_official &&\
- sudo -E -u discourse -H bundle exec rake plugin:install_all_gems &&\
- chown -R discourse /var/run/postgresql
+FROM with_browsers AS release
-WORKDIR /var/www/discourse
-ENV LANG en_US.UTF-8
-ENTRYPOINT sudo -E -u discourse -H ruby script/docker_test.rb
+RUN cd /var/www/discourse &&\
+ sudo -u discourse bundle install --jobs=4 &&\
+ sudo -E -u discourse -H yarn install &&\
+ sudo -u discourse yarn cache clean
+
+RUN cd /var/www/discourse && sudo -E -u discourse -H bundle exec rake plugin:install_all_official &&\
+ sudo -E -u discourse -H bundle exec rake plugin:install_all_gems