Skip to content

Commit e974f44

Browse files
authored
Merge pull request #23 from juroteam/build-update
chore: bump scm to 1.10
2 parents ec8904d + f6c3f09 commit e974f44

File tree

4 files changed

+53
-39
lines changed

4 files changed

+53
-39
lines changed

Dockerfile

Lines changed: 11 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,24 @@
1-
FROM alpine:3.18
1+
FROM alpine:3.22
22

3-
ARG YQ_VERSION=4.42.1
4-
ARG SCM_VERSION=1.7.1
5-
ARG SCM_FILE=scm-backup-1.7.1.09b3532.zip
6-
ARG DOTNET_FILE=aspnetcore-runtime-3.1.32-linux-musl-x64.tar.gz
7-
ARG DOTNET_FILE_SHA512=d67edf1ed7817c002e1f444baf3a48b71d6f3328ed3f63287d744445665db846f63d24f4f8dd97f99d85f9d5f28fd0d1f1b8efa0c88ed7545a3ee9cfc491f7d0
3+
ARG SCM_VERSION=1.10.0
4+
ARG SCM_FILE=scm-backup-1.10.0.c9d19ac.zip
5+
ARG SCM_SHA256=c61351cef35d570d17bc785b9a83cd6962480eb730a79cbafd1aa8400573826e
86

97
ENV SCM_ROOT=/opt/scm-backup
10-
ENV DOTNET_ROOT=/opt/dotnet
11-
ENV PATH=${PATH}:${DOTNET_ROOT}
8+
ENV SCM_LOCAL_FOLDER=${SCM_ROOT}/backup
129
ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1
1310

1411
WORKDIR ${SCM_ROOT}
1512

16-
RUN apk add --no-cache \
17-
bash curl git \
18-
&& apk add pixz \
19-
libgcc libintl libssl1.1 \
20-
libstdc++ zlib curl git \
21-
--no-cache --repository=https://dl-cdn.alpinelinux.org/alpine/edge/community \
22-
# Install dotnet runtime
23-
&& curl -fsL -o ${DOTNET_FILE} https://download.visualstudio.microsoft.com/download/pr/e94c26b7-6ac0-46b9-81f1-e008ce8348cb/41d57ffacf3e151de8039ec3cd007a68/${DOTNET_FILE} \
24-
&& echo "${DOTNET_FILE_SHA512} ${DOTNET_FILE}" > ${DOTNET_FILE}.sha512 \
25-
&& sha512sum -c ${DOTNET_FILE}.sha512 \
26-
&& mkdir -p ${DOTNET_ROOT} \
27-
&& tar zxf ${DOTNET_FILE} -C ${DOTNET_ROOT} \
13+
RUN apk add --no-cache git yq pixz aspnetcore8-runtime \
2814
# Install scm-backup
29-
&& curl -fsL -o ${SCM_FILE} https://github.com/christianspecht/scm-backup/releases/download/${SCM_VERSION}/${SCM_FILE} \
15+
&& wget https://github.com/christianspecht/scm-backup/releases/download/${SCM_VERSION}/${SCM_FILE} \
16+
&& echo "${SCM_SHA256} ${SCM_FILE}" | sha256sum -c - \
3017
&& unzip ${SCM_FILE} \
31-
&& rm -f ${SCM_FILE} ${DOTNET_FILE} ${DOTNET_FILE}.sha512 \
32-
# Install yq (config templating)
33-
&& curl -fSL https://github.com/mikefarah/yq/releases/download/v${YQ_VERSION}/yq_linux_amd64 -o /usr/local/bin/yq \
34-
&& chmod +x /usr/local/bin/yq
18+
&& rm -f ${SCM_FILE} \
19+
&& mkdir -p ${SCM_LOCAL_FOLDER}
3520

36-
COPY entrypoint.sh /usr/local/bin
3721
COPY settings.yml .
38-
RUN chmod +x /usr/local/bin/entrypoint.sh
22+
COPY --chmod=0755 entrypoint.sh /usr/local/bin
3923

4024
ENTRYPOINT ["entrypoint.sh"]
41-
42-
43-

README.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,26 @@
11
# Dockerised SCM Backup
2+
[![GitHub](https://img.shields.io/badge/GitHub-juroteam%2Fdocker--scm--backup-blue?style=flat-square&logo=github)](https://github.com/juroteam/docker-scm-backup)
23

34
[SCM Backup](https://scm-backup.org/) in a Docker container. Default configuration is preset to work with Github.
45

56
## Environment Variables
67

78
To run this project, you will need the following environment variables
89

10+
**Required:**
11+
912
`GH_ORG`
1013

1114
`GH_USER`
1215

1316
`GH_PASS`
1417

18+
**Optional:**
19+
20+
`S3_BUCKET` - If provided, backups will be configured to use S3 storage
21+
22+
> **Note:** When using S3 backup, you are responsible for configuring AWS authentication (credentials, IAM roles, etc.) in your Docker environment.
23+
1524
## Usage/Examples
1625

1726
```shell
@@ -20,4 +29,14 @@ docker run -v ${LOCAL_BACKUP_DIRECTORY}:/opt/scm-backup/backup \
2029
-e GH_PASS=app_password \
2130
-e GH_ORG=org \
2231
juroapp/scm-backup
23-
```
32+
```
33+
34+
**With S3 backup enabled:**
35+
```shell
36+
docker run -v ${LOCAL_BACKUP_DIRECTORY}:/opt/scm-backup/backup \
37+
-e GH_USER=username \
38+
-e GH_PASS=app_password \
39+
-e GH_ORG=org \
40+
-e S3_BUCKET=my-backup-bucket \
41+
juroapp/scm-backup
42+
```

entrypoint.sh

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,22 @@
1-
#!/usr/bin/env bash
2-
set -euo pipefail
1+
#!/bin/sh
2+
set -eu
33

4-
yq e -i '(.sources[] | select(.title == "github").name) = env(GH_ORG)' settings.yml
5-
yq e -i '(.sources[] | select(.title == "github").authName) = env(GH_USER)' settings.yml
6-
yq e -i '(.sources[] | select(.title == "github").password) = env(GH_PASS)' settings.yml
4+
: "${GH_ORG:?GH_ORG is required}"
5+
: "${GH_USER:?GH_USER is required}"
6+
: "${GH_PASS:?GH_PASS is required}"
7+
: "${SCM_LOCAL_FOLDER:?SCM_LOCAL_FOLDER is required}"
78

8-
exec dotnet ScmBackup.dll
9+
yq e -i '
10+
.localFolder = env(SCM_LOCAL_FOLDER)
11+
| with(.sources[] | select(.title == "github");
12+
.name = env(GH_ORG)
13+
| .authName = env(GH_USER)
14+
)
15+
| if has("S3_BUCKET") then
16+
.options.backup.s3BucketName = env(S3_BUCKET)
17+
else
18+
.
19+
end
20+
' settings.yml
21+
22+
exec dotnet ScmBackup.dll

settings.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
localFolder: 'backup'
1+
localFolder: backup
22

33
sources:
44
- title: github
55
hoster: github
66
type: org
77
name: team
88
authName: username
9-
password: password
9+
password: '%GH_PASS%'

0 commit comments

Comments
 (0)