Skip to content

Commit 228772b

Browse files
committed
add docerfile
1 parent 3f4d89b commit 228772b

File tree

2 files changed

+46
-0
lines changed

2 files changed

+46
-0
lines changed

.evergreen/e2e-tests/Dockerfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# "bullseye" is the debian distribution that ubuntu:20.04 is based on
2+
ARG NODE_JS_VERSION=20
3+
FROM node:${NODE_JS_VERSION}-bullseye
4+
5+
COPY . /compass-monorepo-root
6+
WORKDIR /compass-monorepo-root
7+
8+
RUN npm i -g [email protected]
9+
RUN npm run bootstrap-ci
10+
11+
CMD ["npm run test-web"]
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/usr/bin/env bash
2+
3+
post_evergreen_status() {
4+
status="$1"
5+
type="$2"
6+
desc="$3"
7+
should_continue="$4"
8+
curl --silent --show-error --header "Content-Type: application/json" --data \
9+
'{"status": "'"$status"'", "type": "'"$type"'", "desc": "'"$desc"'", "should_continue": '"$should_continue"'}' \
10+
"http://localhost:2285/task_status" || true
11+
}
12+
13+
# NOTE: do not -x here there are "env" vars in the commands
14+
set -e
15+
16+
MONOREPO_ROOT_DIR="$(cd $(dirname "$0")/../..; pwd)"
17+
cd $MONOREPO_ROOT_DIR
18+
19+
echo "building e2e tests image from ${PWD}"
20+
docker build -t compass-e2e-tests:$github_commit --build-arg "NODE_JS_VERSION=$NODE_JS_VERSION" -f "./.evergreen/package-and-publish-e2e-docker-image/Dockerfile" .
21+
echo "e2e tests image built"
22+
23+
# skip if the image already exists
24+
if aws ecr describe-images --region $ECR_REGION --repository-name=compass/e2e-tests --image-ids=imageTag=$github_commit; then
25+
echo "Image with tag '${github_commit}' found in the 'compass/e2e-tests' repository. Setting task status to 'success'..."
26+
post_evergreen_status success test "image tag '${github_commit}' already exists in the 'compass/e2e-tests' repository" false
27+
else
28+
echo "Image with tag '${github_commit}' not found in the 'compass/e2e-tests' repository. Continuing with remainder of task..."
29+
fi
30+
31+
echo "pushing e2e tests image to ECR"
32+
aws ecr get-login-password --region $ECR_REGION | docker login --username AWS --password-stdin $ECR_REGISTRY
33+
docker tag compass-e2e-tests:$github_commit $ECR_REGISTRY/compass/e2e-tests:$github_commit
34+
docker push $ECR_REGISTRY/compass/e2e-tests:$github_commit
35+
echo "image pushed"

0 commit comments

Comments
 (0)