diff --git a/CHANGELOG.md b/CHANGELOG.md index cabac2df..1691cfb1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ and this project adheres to - Manage the document's right (#75) - Update document (#68) - Remove document (#68) +- (docker) dockerize dev frontend (#63) ## Changed diff --git a/Makefile b/Makefile index f65b3a5f..de176e0e 100644 --- a/Makefile +++ b/Makefile @@ -82,13 +82,12 @@ bootstrap: \ data/static \ create-env-files \ build \ - run \ + run-frontend-dev \ migrate \ demo \ back-i18n-compile \ mails-install \ - mails-build \ - install-front-impress + mails-build .PHONY: bootstrap # -- Docker/compose @@ -105,10 +104,7 @@ logs: ## display app-dev logs (follow mode) .PHONY: logs run: ## start the wsgi (production) and development server - @$(COMPOSE) up --force-recreate -d nginx - @$(COMPOSE) up --force-recreate -d app-dev @$(COMPOSE) up --force-recreate -d celery-dev - @$(COMPOSE) up --force-recreate -d keycloak @$(COMPOSE) up --force-recreate -d y-webrtc-signaling @echo "Wait for postgresql to be up..." @$(WAIT_DB) @@ -301,13 +297,9 @@ help: .PHONY: help # Front -install-front-impress: ## Install the frontend dependencies of app Impress - cd $(PATH_FRONT_IMPRESS) && yarn -.PHONY: install-front-impress - -run-front-impress: ## Start app Impress - cd $(PATH_FRONT_IMPRESS) && yarn dev -.PHONY: run-front-impress +run-frontend-dev: ## Install and run the frontend dev + @$(COMPOSE) up --force-recreate -d frontend-dev +.PHONY: run-frontend-dev frontend-i18n-extract: ## Extract the frontend translation inside a json to be used for crowdin cd $(PATH_FRONT) && yarn i18n:extract diff --git a/README.md b/README.md index 26010b1d..56a45d55 100644 --- a/README.md +++ b/README.md @@ -31,10 +31,7 @@ The easiest way to start working on the project is to use GNU Make: $ make bootstrap FLUSH_ARGS='--no-input' ``` -Then you can run the following command to start the project in development mode: -```bash -$ make run-front-impress -``` +Then you can access to the project in development mode by going to http://localhost:3000. You will be prompted to log in, the default credentials are: ```bash username: impress @@ -52,7 +49,7 @@ Your Docker services should now be up and running 🎉 Note that if you need to run them afterwards, you can use the eponym Make rule: ```bash -$ make run +$ make run-frontend-dev ``` ### Adding content diff --git a/docker-compose.yml b/docker-compose.yml index 495825b3..f6b349fb 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -65,6 +65,7 @@ services: - mailcatcher - redis - createbuckets + - nginx celery-dev: user: ${DOCKER_USER:-1000} @@ -118,7 +119,6 @@ services: volumes: - ./docker/files/etc/nginx/conf.d:/etc/nginx/conf.d:ro depends_on: - - app - keycloak dockerize: @@ -155,6 +155,20 @@ services: - /home/frontend/apps/y-webrtc-signaling/node_modules/ - /home/frontend/apps/y-webrtc-signaling/dist/ + frontend-dev: + user: "${DOCKER_USER:-1000}" + build: + context: . + dockerfile: ./src/frontend/Dockerfile + target: impress-dev + ports: + - "3000:3000" + volumes: + - ./src/frontend/apps/impress:/home/frontend/apps/impress + - /home/frontend/node_modules/ + depends_on: + - y-webrtc-signaling + - celery-dev kc_postgresql: image: postgres:14.3 diff --git a/src/frontend/Dockerfile b/src/frontend/Dockerfile index 2d4dc966..778648a9 100644 --- a/src/frontend/Dockerfile +++ b/src/frontend/Dockerfile @@ -39,6 +39,7 @@ COPY ./src/frontend/packages/eslint-config-impress/package.json ./packages/eslin RUN yarn install --frozen-lockfile +COPY .dockerignore ./.dockerignore COPY ./src/frontend/ . ### ---- Front-end builder image ---- @@ -46,6 +47,14 @@ FROM frontend-deps as impress WORKDIR /home/frontend/apps/impress +FROM frontend-deps as impress-dev + +WORKDIR /home/frontend/apps/impress + +EXPOSE 3000 + +CMD [ "yarn", "dev"] + # Tilt will rebuild impress target so, we dissociate impress and impress-builder # to avoid rebuilding the app at every changes. FROM impress as impress-builder @@ -70,4 +79,4 @@ COPY ./docker/files/usr/local/bin/entrypoint /usr/local/bin/entrypoint ENTRYPOINT [ "/usr/local/bin/entrypoint" ] -CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file +CMD ["nginx", "-g", "daemon off;"]