Skip to content

Commit

Permalink
Run server in different docker cmd.
Browse files Browse the repository at this point in the history
  • Loading branch information
Wentao-Kuang committed May 5, 2024
1 parent 28a4306 commit eb52b38
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 7 deletions.
11 changes: 6 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ jobs:
id-token: write
contents: read
needs: [build]
name: Smoke Test
runs-on: ubuntu-latest
env:
DOCKER_AWS_ENV: -e AWS_ACCESS_KEY_ID -e AWS_SECRET_ACCESS_KEY -e AWS_SESSION_TOKEN -e AWS_REGION -e AWS_DEFAULT_REGION
Expand All @@ -207,7 +208,7 @@ jobs:

- name: (Smoke) Start Local Server
run: |
./scripts/bmc.sh ./index.cjs serve --config ${CONFIG_PATH} &
./scripts/bms.sh serve --config ${CONFIG_PATH} &
# Wait for the server to start
timeout 30 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' http://localhost:5000/v1/version)" != "200" ]]; do sleep 0.5; done' || false
Expand All @@ -216,7 +217,7 @@ jobs:
run: ./scripts/bmc.sh --test ./node_modules/@basemaps/smoke/build/

- name: (Smoke) Stop Server
run: docker stop $(docker ps -a -q)
run: docker stop bms

screenshot:
permissions:
Expand All @@ -243,7 +244,7 @@ jobs:

- name: (Screenshot) Screenshot Pull Request Changes
run: |
./scripts/bmc.sh ./index.cjs serve --config ${CONFIG_PATH} --port 5000 &
./scripts/bms.sh serve --config ${CONFIG_PATH} &
# Wait for the server to start
timeout 30 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' http://localhost:5000/v1/version)" != "200" ]]; do sleep 0.5; done' || false
Expand All @@ -257,8 +258,8 @@ jobs:
snapshot-path: .artifacts/visual-snapshots

- name: (Screenshot) Stop Server
run: docker stop $(docker ps -a -q)
run: docker stop bms

visual-diff:
permissions:
id-token: write
Expand Down
5 changes: 3 additions & 2 deletions scripts/bmc.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#!/bin/bash

. ./version.sh

# Run the basemaps/cli as a docker container with all the extra environment vars and args passed in
docker run \
--entrypoint node \
-v ${PWD}:${PWD} \
-p 5000:5000 \
-e AWS_ACCESS_KEY_ID -e AWS_SECRET_ACCESS_KEY -e AWS_SESSION_TOKEN -e AWS_REGION -e AWS_DEFAULT_REGION -e BASEMAPS_HOST \
--rm \
ghcr.io/linz/basemaps/cli:v7.3.0-1-gf14d0bab \
ghcr.io/linz/basemaps/cli:${BASEMAPS_VERSION} \
"$@"
14 changes: 14 additions & 0 deletions scripts/bms.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

. ./version.sh

# Run the basemaps/cli as a docker container with all the extra environment vars and args passed in
# Specific for the basemaps server cmd with a port 5000
docker run \
--name bms
-v ${PWD}:${PWD} \
-p 5000:5000 \
-e AWS_ACCESS_KEY_ID -e AWS_SECRET_ACCESS_KEY -e AWS_SESSION_TOKEN -e AWS_REGION -e AWS_DEFAULT_REGION -e BASEMAPS_HOST \
--rm \
ghcr.io/linz/basemaps/cli:${BASEMAPS_VERSION} \
"$@"
1 change: 1 addition & 0 deletions scripts/version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export BASEMAPS_VERSION=v7.3.0-1-gf14d0bab

0 comments on commit eb52b38

Please sign in to comment.