Skip to content

Commit

Permalink
Update docker build infra
Browse files Browse the repository at this point in the history
  • Loading branch information
jeroen committed Aug 17, 2021
1 parent f2aaa93 commit f082fe4
Show file tree
Hide file tree
Showing 12 changed files with 124 additions and 44 deletions.
67 changes: 67 additions & 0 deletions .github/workflows/base.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Login to GHCR (GitHub Packages)
uses: docker/[email protected]
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
6 changes: 4 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
on:
push:
pull_request:
branches:
- master
workflow_dispatch:

name: Build and test
name: Test build from branch

jobs:
Build:
Expand Down
16 changes: 12 additions & 4 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: Build Docker Images
name: Build distro images

on:
workflow_dispatch:
push:
branches:
- 'master'
workflow_dispatch:
tags:
- '*'

jobs:
build:
Expand All @@ -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

Expand All @@ -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
13 changes: 7 additions & 6 deletions docker/centos-7/Dockerfile
Original file line number Diff line number Diff line change
@@ -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 \
Expand Down Expand Up @@ -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/
Expand Down
13 changes: 7 additions & 6 deletions docker/centos-8/Dockerfile
Original file line number Diff line number Diff line change
@@ -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 \
Expand Down Expand Up @@ -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/
Expand Down
12 changes: 6 additions & 6 deletions docker/debian-11/Dockerfile
Original file line number Diff line number Diff line change
@@ -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 && \
Expand All @@ -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
Expand Down
13 changes: 7 additions & 6 deletions docker/fedora-34/Dockerfile
Original file line number Diff line number Diff line change
@@ -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 \
Expand All @@ -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/
Expand Down
8 changes: 4 additions & 4 deletions docker/ubuntu-18.04/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# syntax=docker/dockerfile:1
ARG BRANCH=2.2
ARG BRANCH=master
ARG RSTUDIO=1.4.1717

# Build image
Expand All @@ -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
Expand Down
8 changes: 4 additions & 4 deletions docker/ubuntu-20.04/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# syntax=docker/dockerfile:1
ARG BRANCH=2.2
ARG BRANCH=master
ARG RSTUDIO=1.4.1717

# Build image
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions rpm/_service
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
<service name="download_url">
<param name="host">github.com</param>
<param name="protocol">https</param>
<param name="path">/opencpu/opencpu-server/archive/v2.0.tar.gz</param>
<param name="path">/opencpu/opencpu-server/archive/master.tar.gz</param>
<param name="filename">opencpu-server-2.0.tar.gz</param>
</service>
<service name="download_url">
<param name="host">raw.githubusercontent.com</param>
<param name="protocol">https</param>
<param name="path">/opencpu/opencpu-server/v2.0/rpm/opencpu.spec</param>
<param name="path">/opencpu/opencpu-server/master/rpm/opencpu.spec</param>
<param name="filename">opencpu.spec</param>
</service>
</services>
6 changes: 3 additions & 3 deletions rpm/buildscript.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion rpm/opencpu.spec
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit f082fe4

Please sign in to comment.