Skip to content

Commit 5052f49

Browse files
committed
Build Docker images for Ubuntu 18.04 and 20.04
1 parent 3247f26 commit 5052f49

File tree

5 files changed

+51
-24
lines changed

5 files changed

+51
-24
lines changed

.dockerignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Library/Homebrew/vendor/portable-ruby
2+
Library/Taps

.github/workflows/docker.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Docker
2+
on:
3+
pull_request:
4+
paths:
5+
- .github/workflows/docker.yml
6+
- Dockerfile
7+
release:
8+
types:
9+
- published
10+
jobs:
11+
ubuntu:
12+
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
version: ["18.04", "20.04"]
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@master
19+
with:
20+
fetch-depth: 0
21+
- name: Build Docker image
22+
run: docker build -t brew --build-arg=version=${{matrix.version}} .
23+
- name: Run brew test-bot
24+
run: docker run --rm brew brew test-bot
25+
- name: Deploy the tagged Docker image to GitHub
26+
if: startsWith(github.ref, 'refs/tags/')
27+
run: |
28+
docker login docker.pkg.github.com -u BrewTestBot -p ${{secrets.GITHUB_TOKEN}}
29+
v=${GITHUB_REF:10}
30+
docker tag brew "docker.pkg.github.com/homebrew/brew/ubuntu${{matrix.version}}:$v"
31+
docker push "docker.pkg.github.com/homebrew/brew/ubuntu${{matrix.version}}:$v"

.github/workflows/tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,14 +187,14 @@ jobs:
187187
brew test-bot
188188
fi
189189
190-
- name: Deploy the latest Docker image
190+
- name: Deploy the latest Docker image to GitHub
191191
if: matrix.os == 'ubuntu-latest' && github.ref == 'refs/heads/master'
192192
run: |
193193
docker login docker.pkg.github.com -u BrewTestBot -p ${{secrets.GITHUB_TOKEN}}
194194
docker tag brew docker.pkg.github.com/homebrew/brew/brew
195195
docker push docker.pkg.github.com/homebrew/brew/brew
196196
197-
- name: Deploy the tagged Docker image
197+
- name: Deploy the tagged Docker image to GitHub
198198
if: matrix.os == 'ubuntu-latest' && startsWith(github.ref, 'refs/tags/')
199199
run: |
200200
docker login docker.pkg.github.com -u BrewTestBot -p ${{secrets.GITHUB_TOKEN}}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@
151151
/docs/vendor
152152

153153
# Unignore our root-level metadata files.
154+
!/.dockerignore
154155
!/.editorconfig
155156
!/.gitignore
156157
!/.yardopts

Dockerfile

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
FROM ubuntu:xenial
2-
LABEL maintainer="Shaun Jackman <[email protected]>"
1+
ARG version=16.04
2+
FROM ubuntu:$version
3+
ARG DEBIAN_FRONTEND=noninteractive
34

45
# hadolint ignore=DL3008
56
RUN apt-get update \
6-
&& apt-get install -y --no-install-recommends software-properties-common \
7-
&& add-apt-repository -y ppa:git-core/ppa \
8-
&& apt-get update \
97
&& apt-get install -y --no-install-recommends \
108
bzip2 \
119
ca-certificates \
@@ -14,6 +12,7 @@ RUN apt-get update \
1412
fonts-dejavu-core \
1513
g++ \
1614
git \
15+
less \
1716
libz-dev \
1817
locales \
1918
make \
@@ -23,29 +22,23 @@ RUN apt-get update \
2322
sudo \
2423
uuid-runtime \
2524
tzdata \
26-
&& rm -rf /var/lib/apt/lists/*
27-
28-
RUN localedef -i en_US -f UTF-8 en_US.UTF-8 \
25+
&& rm -rf /var/lib/apt/lists/* \
26+
&& localedef -i en_US -f UTF-8 en_US.UTF-8 \
2927
&& useradd -m -s /bin/bash linuxbrew \
3028
&& echo 'linuxbrew ALL=(ALL) NOPASSWD:ALL' >>/etc/sudoers
29+
3130
COPY . /home/linuxbrew/.linuxbrew/Homebrew
32-
ARG FORCE_REBUILD
31+
ENV PATH=/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin:$PATH
32+
WORKDIR /home/linuxbrew
3333

3434
# hadolint ignore=DL3003
3535
RUN cd /home/linuxbrew/.linuxbrew \
3636
&& mkdir -p bin etc include lib opt sbin share var/homebrew/linked Cellar \
3737
&& ln -s ../Homebrew/bin/brew /home/linuxbrew/.linuxbrew/bin/ \
38-
&& cd /home/linuxbrew/.linuxbrew/Homebrew \
39-
&& git remote set-url origin https://github.com/Homebrew/brew
40-
41-
WORKDIR /home/linuxbrew
42-
ENV PATH=/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin:$PATH \
43-
SHELL=/bin/bash
44-
45-
# Install portable-ruby, tap homebrew/core, install audit gems, and cleanup
46-
RUN HOMEBREW_NO_ANALYTICS=1 HOMEBREW_NO_AUTO_UPDATE=1 brew tap homebrew/core \
47-
&& chown -R linuxbrew: /home/linuxbrew/.linuxbrew \
48-
&& chmod -R g+w,o-w /home/linuxbrew/.linuxbrew \
49-
&& rm -rf ~/.cache \
38+
&& git -C /home/linuxbrew/.linuxbrew/Homebrew remote set-url origin https://github.com/Homebrew/brew \
39+
&& HOMEBREW_NO_ANALYTICS=1 HOMEBREW_NO_AUTO_UPDATE=1 brew tap homebrew/core \
5040
&& brew install-bundler-gems \
51-
&& brew cleanup
41+
&& brew cleanup \
42+
&& rm -rf ~/.cache \
43+
&& chown -R linuxbrew: /home/linuxbrew/.linuxbrew \
44+
&& chmod -R g+w,o-w /home/linuxbrew/.linuxbrew

0 commit comments

Comments
 (0)