Skip to content

Commit

Permalink
sq
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmasek committed Jan 12, 2025
1 parent fc94dc3 commit ec5e9ef
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 7 deletions.
6 changes: 6 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
FROM debian:bullseye-slim

RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates curl \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

ARG beacon_binary
RUN if [ -z "$beacon_binary" ]; then echo "ERROR: beacon_binary build argument is required" >&2; exit 1; fi
ADD ${beacon_binary} /app/beacon

WORKDIR /app
Expand Down
23 changes: 16 additions & 7 deletions test_docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,25 @@ set -o pipefail # Fail if any part of a pipeline fails
echo "Starting Beacon test."
echo "---------------------"

DOCKER_BUILDKIT=1 docker compose build beacon
echo "Build successful."
echo "-----------------"
# BEACON_BINARY not set
if [ -z "$BEACON_BINARY" ]; then
echo "Building Beacon binary..."
echo "---------------------"
go build .
BEACON_BINARY=./beacon
fi

echo "Building Docker image..."
echo "---------------------"
DOCKER_BUILDKIT=1 docker build --build-arg beacon_binary=${BEACON_BINARY} -t beacon-test .

# try to read env file, but ignore it if it does not exist
# in CI the env will be set without this file
source ~/beacon.github.env || true
source ~/beacon.github.env || echo "Ignore missing file in CI"

docker compose run --rm \
-T \
echo "Running test..."
echo "---------------------"
docker run --rm \
--entrypoint bash \
-e BEACON_EMAIL_SMTP_SERVER=${BEACON_EMAIL_SMTP_SERVER} \
-e BEACON_EMAIL_SMTP_PORT=${BEACON_EMAIL_SMTP_PORT} \
Expand All @@ -26,7 +35,7 @@ docker compose run --rm \
-e BEACON_EMAIL_SEND_TO=${BEACON_EMAIL_SEND_TO} \
-e BEACON_EMAIL_SENDER=${BEACON_EMAIL_SENDER} \
-e BEACON_EMAIL_PREFIX='[staging]' \
beacon -c '
beacon-test -c '
set -e
/app/beacon start &
echo "executing POST"
Expand Down

0 comments on commit ec5e9ef

Please sign in to comment.