Skip to content

Commit f082fe4

Browse files
committed
Update docker build infra
1 parent f2aaa93 commit f082fe4

File tree

12 files changed

+124
-44
lines changed

12 files changed

+124
-44
lines changed

.github/workflows/base.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: Build base image
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
tags:
7+
- '*'
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v2
15+
16+
- name: Parse tag from ref
17+
id: vars
18+
run: echo ::set-output name=tag::${GITHUB_REF#refs/*/}
19+
20+
- name: Set up QEMU
21+
uses: docker/setup-qemu-action@v1
22+
23+
- name: Set up Docker Buildx
24+
uses: docker/setup-buildx-action@v1
25+
26+
- name: Login to DockerHub
27+
uses: docker/[email protected]
28+
with:
29+
username: ${{ secrets.DOCKERHUB_USERNAME }}
30+
password: ${{ secrets.DOCKERHUB_TOKEN }}
31+
32+
- name: Login to GHCR (GitHub Packages)
33+
uses: docker/[email protected]
34+
with:
35+
registry: ghcr.io
36+
username: ${{ github.actor }}
37+
password: ${{ secrets.GITHUB_TOKEN }}
38+
39+
- name: Build opencpu/base
40+
uses: docker/build-push-action@v2
41+
with:
42+
context: docker/base
43+
push: true
44+
tags: |
45+
opencpu/base:latest
46+
opencpu/base:${{ steps.vars.outputs.tag }}
47+
ghcr.io/${{github.repository}}/base:latest
48+
49+
- name: Build opencpu/rstudio
50+
uses: docker/build-push-action@v2
51+
with:
52+
context: docker/rstudio
53+
push: true
54+
tags: |
55+
opencpu/rstudio:latest
56+
opencpu/rstudio:${{ steps.vars.outputs.tag }}
57+
ghcr.io/${{github.repository}}/rstudio:latest
58+
59+
- name: Build opencpu/apps
60+
uses: docker/build-push-action@v2
61+
with:
62+
context: docker/apps
63+
push: true
64+
tags: |
65+
opencpu/apps:latest
66+
opencpu/apps:${{ steps.vars.outputs.tag }}
67+
ghcr.io/${{github.repository}}/apps:latest

.github/workflows/build.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
on:
22
push:
3-
pull_request:
3+
branches:
4+
- master
5+
workflow_dispatch:
46

5-
name: Build and test
7+
name: Test build from branch
68

79
jobs:
810
Build:

.github/workflows/docker.yml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
name: Build Docker Images
1+
name: Build distro images
22

33
on:
4+
workflow_dispatch:
45
push:
5-
branches:
6-
- 'master'
7-
workflow_dispatch:
6+
tags:
7+
- '*'
88

99
jobs:
1010
build:
@@ -17,6 +17,10 @@ jobs:
1717
- name: Checkout
1818
uses: actions/checkout@v2
1919

20+
- name: Parse tag from ref
21+
id: vars
22+
run: echo ::set-output name=tag::${GITHUB_REF#refs/*/}
23+
2024
- name: Set up QEMU
2125
uses: docker/setup-qemu-action@v1
2226

@@ -41,7 +45,11 @@ jobs:
4145
uses: docker/build-push-action@v2
4246
with:
4347
context: docker/${{ matrix.os }}
48+
build-args: |
49+
BRANCH=${{ steps.vars.outputs.tag }}
50+
RSTUDIO=1.4.1717
4451
push: true
4552
tags: |
4653
opencpu/${{matrix.os}}:latest
54+
opencpu/${{matrix.os}}:${{ steps.vars.outputs.tag }}
4755
ghcr.io/${{github.repository}}/${{matrix.os}}:latest

docker/centos-7/Dockerfile

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
FROM centos:centos7
22

3-
ENV BRANCH 2.2
4-
ENV RSTUDIO 1.4.1717
3+
ARG BRANCH=master
4+
ARG RSTUDIO=1.4.1717
55

66
# Enable EPEL
77
RUN \
@@ -31,11 +31,12 @@ RUN \
3131

3232
RUN \
3333
cd ~ && \
34-
wget --quiet https://github.com/opencpu/opencpu-server/archive/v${BRANCH}.tar.gz -O opencpu-server-${BRANCH}.tar.gz && \
35-
tar xzvf opencpu-server-${BRANCH}.tar.gz opencpu-server-${BRANCH}/rpm/opencpu.spec --strip-components 2 && \
36-
mv -f opencpu-server-${BRANCH}.tar.gz ~/rpmbuild/SOURCES/ && \
34+
VERSION=${BRANCH/v/} && \
35+
wget --quiet https://github.com/opencpu/opencpu-server/archive/${BRANCH}.tar.gz -O opencpu-server-${VERSION}.tar.gz && \
36+
tar xzvf opencpu-server-${VERSION}.tar.gz opencpu-server-${VERSION}/rpm/opencpu.spec --strip-components 2 && \
37+
mv -f opencpu-server-${VERSION}.tar.gz ~/rpmbuild/SOURCES/ && \
3738
mv -f opencpu.spec ~/rpmbuild/SPECS/ && \
38-
rpmbuild -ba ~/rpmbuild/SPECS/opencpu.spec --define "branch ${BRANCH}"
39+
rpmbuild -ba ~/rpmbuild/SPECS/opencpu.spec --define "branch ${VERSION}"
3940

4041
RUN \
4142
createrepo ~/rpmbuild/RPMS/x86_64/

docker/centos-8/Dockerfile

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
FROM centos:centos8
22

3-
ENV BRANCH 2.2
4-
ENV RSTUDIO 1.4.1717
3+
ARG BRANCH=master
4+
ARG RSTUDIO=1.4.1717
55

66
# Enable EPEL
77
RUN \
@@ -33,11 +33,12 @@ RUN \
3333

3434
RUN \
3535
cd ~ && \
36-
wget --quiet https://github.com/opencpu/opencpu-server/archive/master.tar.gz -O opencpu-server-master.tar.gz && \
37-
tar xzvf opencpu-server-master.tar.gz opencpu-server-master/rpm/opencpu.spec --strip-components 2 && \
38-
mv -f opencpu-server-master.tar.gz ~/rpmbuild/SOURCES/ && \
36+
VERSION=${BRANCH/v/} && \
37+
wget --quiet https://github.com/opencpu/opencpu-server/archive/${BRANCH}.tar.gz -O opencpu-server-${VERSION}.tar.gz && \
38+
tar xzvf opencpu-server-${VERSION}.tar.gz opencpu-server-${VERSION}/rpm/opencpu.spec --strip-components 2 && \
39+
mv -f opencpu-server-${VERSION}.tar.gz ~/rpmbuild/SOURCES/ && \
3940
mv -f opencpu.spec ~/rpmbuild/SPECS/ && \
40-
rpmbuild -ba ~/rpmbuild/SPECS/opencpu.spec --define "branch master"
41+
rpmbuild -ba ~/rpmbuild/SPECS/opencpu.spec --define "branch ${VERSION}"
4142

4243
RUN \
4344
createrepo ~/rpmbuild/RPMS/x86_64/

docker/debian-11/Dockerfile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
FROM debian:11
22

3-
ENV BRANCH 2.2
4-
ENV RSTUDIO 1.4.1717
3+
ARG BRANCH=master
4+
ARG RSTUDIO=1.4.1717
55

66
RUN \
77
apt-get update && \
@@ -16,10 +16,10 @@ USER builder
1616

1717
RUN \
1818
cd ~ && \
19-
wget --quiet https://github.com/opencpu/opencpu-server/archive/v${BRANCH}.tar.gz && \
20-
tar xzf v${BRANCH}.tar.gz && \
21-
cd opencpu-server-${BRANCH} && \
22-
sed -i 's/bionic/buster/g' debian/changelog && \
19+
wget --quiet https://github.com/opencpu/opencpu-server/archive/${BRANCH}.tar.gz && \
20+
tar xzf ${BRANCH}.tar.gz && rm ${BRANCH}.tar.gz && \
21+
cd opencpu-server-* && \
22+
sed -i 's/focal/bullseye/g' debian/changelog && \
2323
dpkg-buildpackage -us -uc
2424

2525
USER root

docker/fedora-34/Dockerfile

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
FROM fedora:34
22

3-
ENV BRANCH 2.2
4-
ENV RSTUDIO 1.4.1717
3+
ARG BRANCH=master
4+
ARG RSTUDIO=1.4.1717
55

66
# Install.
77
RUN \
@@ -27,11 +27,12 @@ RUN \
2727

2828
RUN \
2929
cd ~ && \
30-
wget --quiet https://github.com/opencpu/opencpu-server/archive/v${BRANCH}.tar.gz -O opencpu-server-${BRANCH}.tar.gz && \
31-
tar xzvf opencpu-server-${BRANCH}.tar.gz opencpu-server-${BRANCH}/rpm/opencpu.spec --strip-components 2 && \
32-
mv -f opencpu-server-${BRANCH}.tar.gz ~/rpmbuild/SOURCES/ && \
30+
VERSION=${BRANCH/v/} && \
31+
wget --quiet https://github.com/opencpu/opencpu-server/archive/${BRANCH}.tar.gz -O opencpu-server-${VERSION}.tar.gz && \
32+
tar xzvf opencpu-server-${VERSION}.tar.gz opencpu-server-${VERSION}/rpm/opencpu.spec --strip-components 2 && \
33+
mv -f opencpu-server-${VERSION}.tar.gz ~/rpmbuild/SOURCES/ && \
3334
mv -f opencpu.spec ~/rpmbuild/SPECS/ && \
34-
rpmbuild -ba ~/rpmbuild/SPECS/opencpu.spec --define "branch ${BRANCH}"
35+
rpmbuild -ba ~/rpmbuild/SPECS/opencpu.spec --define "branch ${VERSION}"
3536

3637
RUN \
3738
createrepo ~/rpmbuild/RPMS/x86_64/

docker/ubuntu-18.04/Dockerfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# syntax=docker/dockerfile:1
2-
ARG BRANCH=2.2
2+
ARG BRANCH=master
33
ARG RSTUDIO=1.4.1717
44

55
# Build image
@@ -24,9 +24,9 @@ USER builder
2424

2525
RUN \
2626
cd ~ && \
27-
wget --quiet https://github.com/opencpu/opencpu-server/archive/v${BRANCH}.tar.gz && \
28-
tar xzf v${BRANCH}.tar.gz && \
29-
cd opencpu-server-${BRANCH} && \
27+
wget --quiet https://github.com/opencpu/opencpu-server/archive/${BRANCH}.tar.gz && \
28+
tar xzf ${BRANCH}.tar.gz && rm ${BRANCH}.tar.gz && \
29+
cd opencpu-server-* && \
3030
dpkg-buildpackage -us -uc
3131

3232
FROM ubuntu:20.04

docker/ubuntu-20.04/Dockerfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# syntax=docker/dockerfile:1
2-
ARG BRANCH=2.2
2+
ARG BRANCH=master
33
ARG RSTUDIO=1.4.1717
44

55
# Build image
@@ -24,9 +24,9 @@ USER builder
2424

2525
RUN \
2626
cd ~ && \
27-
wget --quiet https://github.com/opencpu/opencpu-server/archive/v${BRANCH}.tar.gz && \
28-
tar xzf v${BRANCH}.tar.gz && \
29-
cd opencpu-server-${BRANCH} && \
27+
wget --quiet https://github.com/opencpu/opencpu-server/archive/${BRANCH}.tar.gz && \
28+
tar xzf ${BRANCH}.tar.gz && rm ${BRANCH}.tar.gz && \
29+
cd opencpu-server-* && \
3030
dpkg-buildpackage -us -uc
3131

3232
FROM ubuntu:20.04

rpm/_service

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
<service name="download_url">
33
<param name="host">github.com</param>
44
<param name="protocol">https</param>
5-
<param name="path">/opencpu/opencpu-server/archive/v2.0.tar.gz</param>
5+
<param name="path">/opencpu/opencpu-server/archive/master.tar.gz</param>
66
<param name="filename">opencpu-server-2.0.tar.gz</param>
77
</service>
88
<service name="download_url">
99
<param name="host">raw.githubusercontent.com</param>
1010
<param name="protocol">https</param>
11-
<param name="path">/opencpu/opencpu-server/v2.0/rpm/opencpu.spec</param>
11+
<param name="path">/opencpu/opencpu-server/master/rpm/opencpu.spec</param>
1212
<param name="filename">opencpu.spec</param>
1313
</service>
1414
</services>

0 commit comments

Comments
 (0)