-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add guide to run Dockerized version on macOS
- Loading branch information
1 parent
8e2470d
commit 772b116
Showing
3 changed files
with
63 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
FROM node:20 | ||
|
||
ARG NEXT_PUBLIC_BE_PORT | ||
ARG NEXT_PUBLIC_BE_HOSTNAME | ||
|
||
WORKDIR /app | ||
|
||
COPY . /app | ||
|
||
RUN yarn && yarn build | ||
|
||
ENTRYPOINT [ "yarn", "start", "-H", "0.0.0.0" ] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Ako pustit Docker na macOS | ||
|
||
## Co pustam | ||
|
||
- `docker-compose -f deployment/local-mac/compose.yaml up --build --force-recreate` | ||
- da sa prihodit aj `--detach` ked chceme pustit v backgrounde (bez neho vidime server logy priamo v terminali) | ||
|
||
Treba mat samozrejme Docker a docker-compose atd. | ||
|
||
## Urobene zmeny oproti compose-test | ||
|
||
Ked som chcel pustit Docker na macu, musel som urobil nasledujuce zmeny (poradilo ChatGPT): | ||
|
||
### `compose.yml` | ||
|
||
- zmenil som aj meno suboru (lebo nebuildime "test" environment a.k.a test.strom.sk) | ||
- vymena `network_mode: host` za `ports: - '3000:3000'` - network_mode vraj na macu nefunguje | ||
- pridanie `- NEXT_PUBLIC_BE_HOSTNAME=host.docker.internal` - aby sa to vedelo pripojit na lokalny BE - Docker pouziva takyto hostname pre host machine localhost | ||
- zmenil som porty na 3000/8000 ako standardne pouzivame pre development | ||
- `dockerfile` a `context` cesty podla file struktury novych suborov | ||
|
||
### `Dockerfile` | ||
|
||
- host v `ENTRYPOINT`e na `"0.0.0.0"` | ||
- od ChatGPT: You're trying to start the application with `yarn start -H localhost`. This command might not be correctly binding to all network interfaces. Usually, you'd use `-H 0.0.0.0` to ensure the app listens on all interfaces, including those available within a Docker container. (a naozaj to pomohlo, inak mi stranku browser nenacital) | ||
- pridany `ARG NEXT_PUBLIC_BE_HOSTNAME` pre nacitanie env varu z compose | ||
|
||
### BE `settings.py` | ||
|
||
- `ALLOWED_HOSTS = ['host.docker.internal']` - BE krical, ze treba :shrug: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
services: | ||
webstrom-frontend: | ||
build: | ||
dockerfile: deployment/local-mac/Dockerfile | ||
context: ../.. | ||
args: | ||
- NEXT_PUBLIC_BE_PORT=8000 | ||
- NEXT_PUBLIC_BE_HOSTNAME=host.docker.internal | ||
|
||
image: webstrom-test-frontend | ||
|
||
environment: | ||
- PORT=3000 | ||
- NEXT_PUBLIC_BE_PORT=8000 | ||
- NEXT_PUBLIC_BE_HOSTNAME=host.docker.internal | ||
|
||
ports: | ||
- '3000:3000' | ||
|
||
restart: always |