diff --git a/.github/workflows/base.yml b/.github/workflows/base.yml new file mode 100644 index 00000000..54de2268 --- /dev/null +++ b/.github/workflows/base.yml @@ -0,0 +1,67 @@ +name: Build base image + +on: + workflow_dispatch: + push: + tags: + - '*' + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Parse tag from ref + id: vars + run: echo ::set-output name=tag::${GITHUB_REF#refs/*/} + + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Login to DockerHub + uses: docker/login-action@v1.10.0 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Login to GHCR (GitHub Packages) + uses: docker/login-action@v1.10.0 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build opencpu/base + uses: docker/build-push-action@v2 + with: + context: docker/base + push: true + tags: | + opencpu/base:latest + opencpu/base:${{ steps.vars.outputs.tag }} + ghcr.io/${{github.repository}}/base:latest + + - name: Build opencpu/rstudio + uses: docker/build-push-action@v2 + with: + context: docker/rstudio + push: true + tags: | + opencpu/rstudio:latest + opencpu/rstudio:${{ steps.vars.outputs.tag }} + ghcr.io/${{github.repository}}/rstudio:latest + + - name: Build opencpu/apps + uses: docker/build-push-action@v2 + with: + context: docker/apps + push: true + tags: | + opencpu/apps:latest + opencpu/apps:${{ steps.vars.outputs.tag }} + ghcr.io/${{github.repository}}/apps:latest diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 36752506..94d08b27 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -1,8 +1,10 @@ on: push: - pull_request: + branches: + - master + workflow_dispatch: -name: Build and test +name: Test build from branch jobs: Build: diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index ebbd2d00..2a760fa3 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -1,10 +1,10 @@ -name: Build Docker Images +name: Build distro images on: + workflow_dispatch: push: - branches: - - 'master' - workflow_dispatch: + tags: + - '*' jobs: build: @@ -17,6 +17,10 @@ jobs: - name: Checkout uses: actions/checkout@v2 + - name: Parse tag from ref + id: vars + run: echo ::set-output name=tag::${GITHUB_REF#refs/*/} + - name: Set up QEMU uses: docker/setup-qemu-action@v1 @@ -41,7 +45,11 @@ jobs: uses: docker/build-push-action@v2 with: context: docker/${{ matrix.os }} + build-args: | + BRANCH=${{ steps.vars.outputs.tag }} + RSTUDIO=1.4.1717 push: true tags: | opencpu/${{matrix.os}}:latest + opencpu/${{matrix.os}}:${{ steps.vars.outputs.tag }} ghcr.io/${{github.repository}}/${{matrix.os}}:latest diff --git a/docker/centos-7/Dockerfile b/docker/centos-7/Dockerfile index e161c7ef..e51ad6e9 100644 --- a/docker/centos-7/Dockerfile +++ b/docker/centos-7/Dockerfile @@ -1,7 +1,7 @@ FROM centos:centos7 -ENV BRANCH 2.2 -ENV RSTUDIO 1.4.1717 +ARG BRANCH=master +ARG RSTUDIO=1.4.1717 # Enable EPEL RUN \ @@ -31,11 +31,12 @@ RUN \ RUN \ cd ~ && \ - wget --quiet https://github.com/opencpu/opencpu-server/archive/v${BRANCH}.tar.gz -O opencpu-server-${BRANCH}.tar.gz && \ - tar xzvf opencpu-server-${BRANCH}.tar.gz opencpu-server-${BRANCH}/rpm/opencpu.spec --strip-components 2 && \ - mv -f opencpu-server-${BRANCH}.tar.gz ~/rpmbuild/SOURCES/ && \ + VERSION=${BRANCH/v/} && \ + wget --quiet https://github.com/opencpu/opencpu-server/archive/${BRANCH}.tar.gz -O opencpu-server-${VERSION}.tar.gz && \ + tar xzvf opencpu-server-${VERSION}.tar.gz opencpu-server-${VERSION}/rpm/opencpu.spec --strip-components 2 && \ + mv -f opencpu-server-${VERSION}.tar.gz ~/rpmbuild/SOURCES/ && \ mv -f opencpu.spec ~/rpmbuild/SPECS/ && \ - rpmbuild -ba ~/rpmbuild/SPECS/opencpu.spec --define "branch ${BRANCH}" + rpmbuild -ba ~/rpmbuild/SPECS/opencpu.spec --define "branch ${VERSION}" RUN \ createrepo ~/rpmbuild/RPMS/x86_64/ diff --git a/docker/centos-8/Dockerfile b/docker/centos-8/Dockerfile index a187a471..6033c5f2 100644 --- a/docker/centos-8/Dockerfile +++ b/docker/centos-8/Dockerfile @@ -1,7 +1,7 @@ FROM centos:centos8 -ENV BRANCH 2.2 -ENV RSTUDIO 1.4.1717 +ARG BRANCH=master +ARG RSTUDIO=1.4.1717 # Enable EPEL RUN \ @@ -33,11 +33,12 @@ RUN \ RUN \ cd ~ && \ - wget --quiet https://github.com/opencpu/opencpu-server/archive/master.tar.gz -O opencpu-server-master.tar.gz && \ - tar xzvf opencpu-server-master.tar.gz opencpu-server-master/rpm/opencpu.spec --strip-components 2 && \ - mv -f opencpu-server-master.tar.gz ~/rpmbuild/SOURCES/ && \ + VERSION=${BRANCH/v/} && \ + wget --quiet https://github.com/opencpu/opencpu-server/archive/${BRANCH}.tar.gz -O opencpu-server-${VERSION}.tar.gz && \ + tar xzvf opencpu-server-${VERSION}.tar.gz opencpu-server-${VERSION}/rpm/opencpu.spec --strip-components 2 && \ + mv -f opencpu-server-${VERSION}.tar.gz ~/rpmbuild/SOURCES/ && \ mv -f opencpu.spec ~/rpmbuild/SPECS/ && \ - rpmbuild -ba ~/rpmbuild/SPECS/opencpu.spec --define "branch master" + rpmbuild -ba ~/rpmbuild/SPECS/opencpu.spec --define "branch ${VERSION}" RUN \ createrepo ~/rpmbuild/RPMS/x86_64/ diff --git a/docker/debian-11/Dockerfile b/docker/debian-11/Dockerfile index 9f4137cd..fa2b988f 100644 --- a/docker/debian-11/Dockerfile +++ b/docker/debian-11/Dockerfile @@ -1,7 +1,7 @@ FROM debian:11 -ENV BRANCH 2.2 -ENV RSTUDIO 1.4.1717 +ARG BRANCH=master +ARG RSTUDIO=1.4.1717 RUN \ apt-get update && \ @@ -16,10 +16,10 @@ USER builder RUN \ cd ~ && \ - wget --quiet https://github.com/opencpu/opencpu-server/archive/v${BRANCH}.tar.gz && \ - tar xzf v${BRANCH}.tar.gz && \ - cd opencpu-server-${BRANCH} && \ - sed -i 's/bionic/buster/g' debian/changelog && \ + wget --quiet https://github.com/opencpu/opencpu-server/archive/${BRANCH}.tar.gz && \ + tar xzf ${BRANCH}.tar.gz && rm ${BRANCH}.tar.gz && \ + cd opencpu-server-* && \ + sed -i 's/focal/bullseye/g' debian/changelog && \ dpkg-buildpackage -us -uc USER root diff --git a/docker/fedora-34/Dockerfile b/docker/fedora-34/Dockerfile index 8b70489e..c4ffbb5c 100644 --- a/docker/fedora-34/Dockerfile +++ b/docker/fedora-34/Dockerfile @@ -1,7 +1,7 @@ FROM fedora:34 -ENV BRANCH 2.2 -ENV RSTUDIO 1.4.1717 +ARG BRANCH=master +ARG RSTUDIO=1.4.1717 # Install. RUN \ @@ -27,11 +27,12 @@ RUN \ RUN \ cd ~ && \ - wget --quiet https://github.com/opencpu/opencpu-server/archive/v${BRANCH}.tar.gz -O opencpu-server-${BRANCH}.tar.gz && \ - tar xzvf opencpu-server-${BRANCH}.tar.gz opencpu-server-${BRANCH}/rpm/opencpu.spec --strip-components 2 && \ - mv -f opencpu-server-${BRANCH}.tar.gz ~/rpmbuild/SOURCES/ && \ + VERSION=${BRANCH/v/} && \ + wget --quiet https://github.com/opencpu/opencpu-server/archive/${BRANCH}.tar.gz -O opencpu-server-${VERSION}.tar.gz && \ + tar xzvf opencpu-server-${VERSION}.tar.gz opencpu-server-${VERSION}/rpm/opencpu.spec --strip-components 2 && \ + mv -f opencpu-server-${VERSION}.tar.gz ~/rpmbuild/SOURCES/ && \ mv -f opencpu.spec ~/rpmbuild/SPECS/ && \ - rpmbuild -ba ~/rpmbuild/SPECS/opencpu.spec --define "branch ${BRANCH}" + rpmbuild -ba ~/rpmbuild/SPECS/opencpu.spec --define "branch ${VERSION}" RUN \ createrepo ~/rpmbuild/RPMS/x86_64/ diff --git a/docker/ubuntu-18.04/Dockerfile b/docker/ubuntu-18.04/Dockerfile index dd89db04..43cdbead 100644 --- a/docker/ubuntu-18.04/Dockerfile +++ b/docker/ubuntu-18.04/Dockerfile @@ -1,5 +1,5 @@ # syntax=docker/dockerfile:1 -ARG BRANCH=2.2 +ARG BRANCH=master ARG RSTUDIO=1.4.1717 # Build image @@ -24,9 +24,9 @@ USER builder RUN \ cd ~ && \ - wget --quiet https://github.com/opencpu/opencpu-server/archive/v${BRANCH}.tar.gz && \ - tar xzf v${BRANCH}.tar.gz && \ - cd opencpu-server-${BRANCH} && \ + wget --quiet https://github.com/opencpu/opencpu-server/archive/${BRANCH}.tar.gz && \ + tar xzf ${BRANCH}.tar.gz && rm ${BRANCH}.tar.gz && \ + cd opencpu-server-* && \ dpkg-buildpackage -us -uc FROM ubuntu:20.04 diff --git a/docker/ubuntu-20.04/Dockerfile b/docker/ubuntu-20.04/Dockerfile index 8b1ff3e9..ee1a710f 100644 --- a/docker/ubuntu-20.04/Dockerfile +++ b/docker/ubuntu-20.04/Dockerfile @@ -1,5 +1,5 @@ # syntax=docker/dockerfile:1 -ARG BRANCH=2.2 +ARG BRANCH=master ARG RSTUDIO=1.4.1717 # Build image @@ -24,9 +24,9 @@ USER builder RUN \ cd ~ && \ - wget --quiet https://github.com/opencpu/opencpu-server/archive/v${BRANCH}.tar.gz && \ - tar xzf v${BRANCH}.tar.gz && \ - cd opencpu-server-${BRANCH} && \ + wget --quiet https://github.com/opencpu/opencpu-server/archive/${BRANCH}.tar.gz && \ + tar xzf ${BRANCH}.tar.gz && rm ${BRANCH}.tar.gz && \ + cd opencpu-server-* && \ dpkg-buildpackage -us -uc FROM ubuntu:20.04 diff --git a/rpm/_service b/rpm/_service index f356d3c4..359d4ccb 100644 --- a/rpm/_service +++ b/rpm/_service @@ -2,13 +2,13 @@ github.com https - /opencpu/opencpu-server/archive/v2.0.tar.gz + /opencpu/opencpu-server/archive/master.tar.gz opencpu-server-2.0.tar.gz raw.githubusercontent.com https - /opencpu/opencpu-server/v2.0/rpm/opencpu.spec + /opencpu/opencpu-server/master/rpm/opencpu.spec opencpu.spec diff --git a/rpm/buildscript.sh b/rpm/buildscript.sh index 7d13ef04..cac69e3d 100644 --- a/rpm/buildscript.sh +++ b/rpm/buildscript.sh @@ -25,9 +25,9 @@ mv -f rapache.spec ~/rpmbuild/SPECS/ rpmbuild -ba ~/rpmbuild/SPECS/rapache.spec # Get opencpu sources -wget https://github.com/opencpu/opencpu-server/archive/v2.2.tar.gz -O opencpu-server-2.2.tar.gz -tar xzvf opencpu-server-2.2.tar.gz opencpu-server-2.2/rpm/opencpu.spec --strip-components 2 -mv -f opencpu-server-2.2.tar.gz ~/rpmbuild/SOURCES/ +wget https://github.com/opencpu/opencpu-server/archive/master.tar.gz -O opencpu-server-master.tar.gz +tar xzvf opencpu-server-master.tar.gz opencpu-server-master/rpm/opencpu.spec --strip-components 2 +mv -f opencpu-server-master.tar.gz ~/rpmbuild/SOURCES/ mv -f opencpu.spec ~/rpmbuild/SPECS/ # Builds 'opencpu-server' and 'opencpu-lib' rpm diff --git a/rpm/opencpu.spec b/rpm/opencpu.spec index 9cbaae0e..4e16be30 100644 --- a/rpm/opencpu.spec +++ b/rpm/opencpu.spec @@ -1,5 +1,5 @@ # Github ref, default to 2.2 branch -%{!?branch: %define branch 2.2} +%{!?branch: %define branch master} Name: opencpu Version: 2.2.5