-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.git-smoke
More file actions
60 lines (53 loc) · 2.83 KB
/
Copy pathDockerfile.git-smoke
File metadata and controls
60 lines (53 loc) · 2.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# Linked git protocol smoke runner for the compose test stack.
#
# Unlike `git-cli` (which uses `network_mode: host` for the cargo-native
# black-box harness that spawns its own service on the host), this image is
# designed to join `networks.default` and exercise push/pull against the
# compose-hosted `mega2` service over the internal bridge network
# (http://mega2:8000/).
#
# It extends the pinned alpine/git base (same git + git-lfs versions as
# `git-cli`) and adds:
# - bash: `scripts/git_protocol_smoke.sh` uses bash features ([[ ]], local,
# arrays) that Alpine's /bin/sh does not provide.
# - postgresql-client: the smoke flow seeds a one-off access_token row into
# the compose `postgres` service before running the push/delete matrix
# (same pattern as the git-protocol-smoke CI job).
#
# Build context = mega2 repo root:
# docker compose -p mega2-it -f docker/docker-compose.test.yml --profile git build git-smoke
FROM alpine/git:v2.49.1@sha256:c0280cf9572316299b08544065d3bf35db65043d5e3963982ec50647d2746e26
ARG TARGETARCH
ARG GIT_LFS_VERSION=3.7.1
USER root
# Install bash + postgresql-client (psql) + curl + ripgrep on top of alpine/git.
# curl: product API write smoke (scripts/api_write_smoke_storage_only.sh).
# ripgrep (rg): ref/content assertions in protocol and API smoke scripts.
RUN set -eux; \
apk add --no-cache bash postgresql-client curl ripgrep; \
test -x /bin/bash; \
test -x /usr/bin/psql; \
test -x /usr/bin/curl; \
test -x /usr/bin/rg
# Install git-lfs (same pinned version as Dockerfile.git-cli).
RUN set -eux; \
arch="${TARGETARCH:-$(uname -m)}"; \
case "$arch" in \
amd64|x86_64) arch=amd64; sha256=1c0b6ee5200ca708c5cebebb18fdeb0e1c98f1af5c1a9cba205a4c0ab5a5ec08 ;; \
arm64|aarch64) arch=arm64; sha256=73a9c90eeb4312133a63c3eaee0c38c019ea7bfa0953d174809d25b18588dd8d ;; \
*) echo "unsupported git-lfs architecture: $arch" >&2; exit 1 ;; \
esac; \
archive="git-lfs-linux-${arch}-v${GIT_LFS_VERSION}.tar.gz"; \
wget -O "/tmp/$archive" "https://github.com/git-lfs/git-lfs/releases/download/v${GIT_LFS_VERSION}/$archive"; \
echo "$sha256 /tmp/$archive" | sha256sum -c -; \
tar -xzf "/tmp/$archive" -C /tmp; \
cp "/tmp/git-lfs-${GIT_LFS_VERSION}/git-lfs" /usr/local/bin/git-lfs; \
chmod 0755 /usr/local/bin/git-lfs; \
rm -rf "/tmp/$archive" "/tmp/git-lfs-${GIT_LFS_VERSION}"; \
test "$(git lfs version | cut -d' ' -f1)" = "git-lfs/${GIT_LFS_VERSION}"
# The smoke script runs as the compose user; give it a passwd entry so git/ssh
# do not fail with "No user exists for uid N".
RUN adduser -D -u 1000 -g 1000 -h /home/gitsmoke -s /bin/bash gitsmoke
# Default: stay up so `docker compose exec` can drive the smoke interactively.
# Override with `command:` in compose to run the smoke automatically.
ENTRYPOINT ["/bin/bash", "-c", "exec sleep infinity"]