Skip to content

Commit 042e2f9

Browse files
add compose file
1 parent 2f9c058 commit 042e2f9

3 files changed

Lines changed: 17 additions & 4 deletions

File tree

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ RUN npm ci
88
COPY . .
99
RUN npm run build
1010

11-
EXPOSE 8080
11+
EXPOSE 3000
1212

1313
CMD ["npm", "start"]

README.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,21 @@ docker build -t learn_mobile-preview .
3232
Run it:
3333

3434
```bash
35-
docker run --rm -p 8080:8080 learn_mobile-preview
35+
docker run --rm -p 3000:3000 learn_mobile-preview
3636
```
3737

38-
Open `http://localhost:8080`. The phone iframe points at `/__expo_preview/`, which the Vite server proxies to Expo web at `http://localhost:3001` by default. In Docker, that default only works when Expo is reachable from the container as `localhost:3001`.
38+
Open `http://localhost:3000`. The phone iframe points at `/__expo_preview/`, which the Vite server proxies to Expo web at `http://localhost:3001` by default. In Docker, that default only works when Expo is reachable from the container as `localhost:3001`.
3939

4040
To target a different Expo web URL:
4141

4242
```bash
43-
docker run --rm -p 8080:8080 -e EXPO_WEB_URL="http://host.docker.internal:3001" learn_mobile-preview
43+
docker run --rm -p 3000:3000 -e EXPO_WEB_URL="http://host.docker.internal:3001" learn_mobile-preview
44+
```
45+
46+
Or use Docker Compose so the port mapping is stored in config:
47+
48+
```bash
49+
docker compose up
4450
```
4551

4652
## Container Registry

docker-compose.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
services:
2+
mobile-preview:
3+
image: ghcr.io/codesignal/learn_mobile-preview:latest
4+
ports:
5+
- "3000:3000"
6+
environment:
7+
EXPO_WEB_URL: http://host.docker.internal:3001

0 commit comments

Comments
 (0)