Skip to content

Commit 443c8aa

Browse files
committed
Make main Dockerfile
1 parent ebfa283 commit 443c8aa

File tree

4 files changed

+66
-93
lines changed

4 files changed

+66
-93
lines changed

.github/workflows/docker-image.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ jobs:
1818
run: docker build . --file Dockerfile --tag backup-utils:${GITHUB_RUN_ID}
1919
- name: Build the Alpine Docker image
2020
run: docker build . --file Dockerfile.alpine --tag backup-utils-alpine:${GITHUB_RUN_ID}
21-
- name: Build the Rsync source Docker image
22-
run: docker build . --file Dockerfile.rsync --tag backup-utils-rsync:${GITHUB_RUN_ID}
2321
- name: Run tests in Ubuntu Docker image
2422
run: |
2523
docker run backup-utils:${GITHUB_RUN_ID} ghe-backup --version
@@ -28,8 +26,3 @@ jobs:
2826
run: |
2927
docker run backup-utils-alpine:${GITHUB_RUN_ID} ghe-backup --version
3028
docker run backup-utils-alpine:${GITHUB_RUN_ID} rsync --version
31-
- name: Run tests in Rsync source Docker image
32-
run: |
33-
docker run backup-utils-rsync:${GITHUB_RUN_ID} ghe-backup --version
34-
docker run backup-utils-rsync:${GITHUB_RUN_ID} rsync --version
35-

.github/workflows/rsync-docker-bump.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Update Rsync Tag in Dockerfile.rsync
1+
name: Update Rsync Tag in Dockerfile
22

33
on:
44
schedule:
@@ -17,17 +17,17 @@ jobs:
1717
run: |
1818
curl --silent "https://api.github.com/repos/WayneD/rsync/tags" | jq -r '.[0].name' | xargs -I {} echo "::set-output name=latest_tag::{}"
1919
20-
- name: Update Dockerfile.rsync with latest tag
20+
- name: Update Dockerfile with latest tag
2121
run: |
22-
sed -i -E "s/RSYNC_TAG=[0-9\.]+/RSYNC_TAG=${{ steps.latest_tag.outputs.latest_tag }}/g" Dockerfile.rsync
22+
sed -i -E "s/RSYNC_TAG=[0-9\.]+/RSYNC_TAG=${{ steps.latest_tag.outputs.latest_tag }}/g" Dockerfile
2323
2424
- name: Create Pull Request for tag update
2525
uses: peter-evans/create-pull-request@v3
2626
with:
2727
token: ${{ secrets.GITHUB_TOKEN }}
28-
commit-message: "Update rsync tag in Dockerfile.rsync"
29-
title: "Update rsync tag in Dockerfile.rsync"
30-
body: "This PR updates the rsync tag in the Dockerfile.rsync to the latest tagged version."
28+
commit-message: "Update rsync tag in Dockerfile"
29+
title: "Update rsync tag in Dockerfile"
30+
body: "This PR updates the rsync tag in the Dockerfile to the latest tagged version."
3131
branch: "update-rsync-tag"
3232
base: "master"
3333
path: "."

Dockerfile

Lines changed: 60 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,71 @@
1-
FROM ubuntu:focal
1+
# Multi stage build for backup-utils
2+
# Build layer is for compiling rsync from source
3+
# Runtime layer is for running backup-utils
4+
# https://docs.docker.com/develop/develop-images/multistage-build/
5+
# https://docs.docker.com/engine/userguide/eng-image/multistage-build/
26

3-
RUN apt-get -q -y update && \
4-
apt-get install -y --no-install-recommends \
7+
# Build layer
8+
FROM ubuntu:focal AS build
9+
10+
# Install build dependencies
11+
RUN apt-get update && apt-get install --no-install-recommends -y \
12+
gcc \
13+
g++ \
14+
gawk \
15+
autoconf \
16+
make \
17+
automake \
18+
python3-cmarkgfm \
19+
acl \
20+
libacl1-dev \
21+
attr \
22+
libattr1-dev \
23+
libxxhash-dev \
24+
libzstd-dev \
25+
liblz4-dev \
26+
libssl-dev \
27+
git \
28+
jq \
29+
curl \
530
tar \
6-
rsync \
31+
gzip \
732
ca-certificates \
8-
ssh \
33+
&& rm -rf /var/lib/apt/lists/*
34+
35+
# Download rsync source from https://github.com/WayneD/rsync/archive/refs/tags/[TAG].tar.gz pinned to specified tag
36+
ARG RSYNC_TAG=v3.2.7
37+
RUN curl https://github.com/WayneD/rsync/archive/refs/tags/${RSYNC_TAG}.tar.gz -L -o ${RSYNC_TAG}.tar.gz
38+
RUN mkdir -p /rsync-${RSYNC_TAG}&& tar -xzf ${RSYNC_TAG}.tar.gz -C /rsync-${RSYNC_TAG} --strip-components=1 && ls -la
39+
# Change to the working directory of the rsync source
40+
WORKDIR /rsync-${RSYNC_TAG}
41+
RUN ls -la && ./configure
42+
RUN make
43+
RUN make install
44+
45+
# Reset working directory
46+
WORKDIR /
47+
48+
# Runtime layer
49+
FROM ubuntu:focal AS runtime
50+
51+
# Install runtime dependencies - bash, git, OpenSSH 5.6 or newer, and jq v1.5 or newer.
52+
RUN apt-get update && apt-get install --no-install-recommends -y \
53+
bash \
954
git \
55+
openssh-client \
56+
jq \
1057
moreutils \
11-
gawk \
58+
gawk \
59+
ca-certificates \
60+
xxhash \
1261
&& rm -rf /var/lib/apt/lists/*
1362

63+
# Copy rsync from build layer
64+
COPY --from=build /usr/local/bin/rsync /usr/local/bin/rsync
65+
66+
# Copy backup-utils from repository into /backup-utils
1467
COPY ./ /backup-utils/
68+
1569
WORKDIR /backup-utils
1670

1771
RUN chmod +x /backup-utils/share/github-backup-utils/ghe-docker-init

Dockerfile.rsync

Lines changed: 0 additions & 74 deletions
This file was deleted.

0 commit comments

Comments
 (0)