Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

YJDH-718 | Fix Kesäseteli's frontend docker developing, hot reload & permissions #3604

Merged
merged 1 commit into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion compose.employer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,22 @@ services:
dockerfile: Dockerfile-localdevelopment
target: development
args:
PORT: 3100
PROJECT: kesaseteli
FOLDER: employer
platform: linux/amd64
volumes:
- ./frontend:/app
# Don't volume map these dirs to avoid ownership/permission issues:
- /app/node_modules
- /app/.next
- /app/shared/node_modules
- /app/shared/.next
- /app/kesaseteli/employer/node_modules
- /app/kesaseteli/employer/.next
env_file:
- .env.kesaseteli
environment:
- WATCHPACK_POLLING=${WATCHPACK_POLLING:-true}
- PORT=3000
container_name: kesaseteli-employer

Expand Down
18 changes: 16 additions & 2 deletions compose.handler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,23 @@ services:
dockerfile: Dockerfile-localdevelopment
target: development
args:
PORT: 3100
PROJECT: kesaseteli
FOLDER: youth
platform: linux/amd64
volumes:
- ./frontend:/app
# Don't volume map these dirs to avoid ownership/permission issues:
- /app/node_modules
- /app/.next
- /app/shared/node_modules
- /app/shared/.next
- /app/kesaseteli/youth/node_modules
- /app/kesaseteli/youth/.next
env_file:
- .env.kesaseteli
environment:
- WATCHPACK_POLLING=${WATCHPACK_POLLING:-true}
- PORT=3100
container_name: kesaseteli-youth

handler:
Expand All @@ -61,16 +68,23 @@ services:
dockerfile: Dockerfile-localdevelopment
target: development
args:
PORT: 3200
PROJECT: kesaseteli
FOLDER: handler
platform: linux/amd64
volumes:
- ./frontend:/app
# Don't volume map these dirs to avoid ownership/permission issues:
- /app/node_modules
- /app/.next
- /app/shared/node_modules
- /app/shared/.next
- /app/kesaseteli/handler/node_modules
- /app/kesaseteli/handler/.next
env_file:
- .env.kesaseteli
environment:
- WATCHPACK_POLLING=${WATCHPACK_POLLING:-true}
- PORT=3200
container_name: kesaseteli-handler

local-proxy:
Expand Down
13 changes: 13 additions & 0 deletions frontend/Dockerfile-localdevelopment
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ COPY --chown=default:default $PROJECT/shared/package.json* $PROJECT/shared/packa
COPY --chown=default:default shared/package.json shared/package.json
RUN --mount=type=cache,target="$PWD/.yarn_cache",sharing=locked YARN_CACHE_FOLDER="$PWD"/.yarn_cache yarn --frozen-lockfile --check-files --network-timeout 600000

# Ensure the project's .next directory exist and is accessible
# so that the express server can access the files
RUN mkdir -p $PROJECT/$FOLDER/.next \
&& chown -R default:default $PROJECT/$FOLDER/.next \
&& chmod -R u=rwx,go=rx $PROJECT/$FOLDER/.next

# =============================
FROM appbase AS development
# =============================
Expand All @@ -55,6 +61,13 @@ ENV NODE_OPTIONS="--max_old_space_size=2048"

ARG PROJECT
ARG FOLDER
# Enable hot reload by default by polling for file changes.
#
# NOTE: Can be disabled by setting WATCHPACK_POLLING=false
# if hot reload works on your system without polling to save CPU time.
ARG WATCHPACK_POLLING=true
ENV WATCHPACK_POLLING=${WATCHPACK_POLLING}

# Use non-root user
USER default
WORKDIR /app
Expand Down
Loading