Skip to content

Commit 8322072

Browse files
rolodatosanex3339
andauthored
Optimize Docker builds and E2E (#33)
Co-authored-by: sanex3339 <[email protected]>
1 parent 60ad769 commit 8322072

File tree

7 files changed

+27
-22
lines changed

7 files changed

+27
-22
lines changed

.dockerignore

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.idea
2-
node_modules
3-
docker-compose.*
1+
**/.idea
2+
**/node_modules
3+
**/docker-compose.*
44
.dockerignore

.github/workflows/e2e-tests.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ jobs:
2828
- name: Run Sample App in Docker
2929
run: |
3030
cp .env.docker.example .env.docker &&
31-
npm run docker:up -- -d &&
32-
while ! nc -z localhost 4400; do sleep 1; done
31+
npm run docker:e2e:up -- --wait
3332
3433
- name: Install Chrome v111
3534
uses: browser-actions/setup-chrome@v1

docker-compose.local-dist.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
services:
2+
metabase:
3+
volumes:
4+
- type: bind
5+
source: ./local-dist/metabase.jar
6+
target: /app/metabase.jar
7+
read_only: true
8+
bind:
9+
create_host_path: false

docker-compose.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
services:
22
metabase:
3-
build:
4-
context: .
5-
dockerfile: metabase/Dockerfile
3+
image: metabase/metabase-enterprise:v1.55.x
64
environment:
7-
MB_CONFIG_FILE_PATH: "./app/init-config.yml"
5+
MB_CONFIG_FILE_PATH: /app/config.yml
86
MB_JETTY_PORT: "${MB_PORT}"
97
MB_EDITION: "ee"
108
MB_SITE_URL: "http://localhost:${MB_PORT}/"
@@ -19,6 +17,8 @@ services:
1917
retries: 10
2018
ports:
2119
- "${MB_PORT}:${MB_PORT}"
20+
volumes:
21+
- ./metabase/config.yml:/app/config.yml
2222

2323
client:
2424
depends_on:
@@ -35,6 +35,11 @@ services:
3535
environment:
3636
CLIENT_PORT: "${CLIENT_PORT}"
3737
VITE_METABASE_INSTANCE_URL: "http://localhost:${MB_PORT}"
38+
healthcheck:
39+
test: curl --fail -X GET -I "http://localhost:${CLIENT_PORT}/" || exit 1
40+
interval: 2s
41+
timeout: 2s
42+
retries: 5
3843
ports:
3944
- "${CLIENT_PORT}:${CLIENT_PORT}"
4045
volumes:

metabase/Dockerfile

Lines changed: 0 additions & 11 deletions
This file was deleted.
File renamed without changes.

package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,11 @@
33
"private": true,
44
"version": "0.0.0",
55
"scripts": {
6-
"start": "npm run docker:up",
6+
"start": "npm run docker:up -- --build",
77
"docker:up": "docker compose --env-file .env.docker up",
8-
"docker:down": "docker compose --env-file .env.docker down --rmi all --volumes"
8+
"docker:e2e:up": "yarn docker:up",
9+
"docker:local-dist:up": "docker compose -f docker-compose.yml -f docker-compose.local-dist.yml --env-file .env.docker up",
10+
"docker:down": "docker compose --env-file .env.docker down",
11+
"docker:rm": "yarn docker:down --rmi all --volumes"
912
}
1013
}

0 commit comments

Comments
 (0)