diff --git a/Makefile b/Makefile index 248de96a..f7f777dc 100644 --- a/Makefile +++ b/Makefile @@ -23,7 +23,12 @@ clean-install: clean ## Docker commands for evaluation purposes docker-build: - docker-compose -f docker-compose-dev.yml build + docker-compose -f docker-compose-dev.yml build fittrackee + +docker-build-all: docker-build docker-build-client + +docker-build-client: + docker-compose -f docker-compose-dev.yml build fittrackee_client docker-init: docker-init-db docker-restart docker-run-workers @@ -42,11 +47,15 @@ docker-restart: docker-run-all: docker-run docker-run-workers docker-run: - docker-compose -f docker-compose-dev.yml up -d + docker-compose -f docker-compose-dev.yml up -d fittrackee docker-run-workers: docker-compose -f docker-compose-dev.yml exec -d fittrackee docker/run-workers.sh +docker-serve-client: + docker-compose -f docker-compose-dev.yml up fittrackee_client -d + docker-compose -f docker-compose-dev.yml exec fittrackee_client react-scripts start + docker-shell: docker-compose -f docker-compose-dev.yml exec fittrackee docker/shell.sh @@ -54,7 +63,7 @@ docker-stop: docker-compose -f docker-compose-dev.yml stop docker-up: - docker-compose -f docker-compose-dev.yml up + docker-compose -f docker-compose-dev.yml up fittrackeee downgrade-db: $(FLASK) db downgrade --directory $(MIGRATIONS) diff --git a/docker-compose-dev.yml b/docker-compose-dev.yml index 85d6a1de..211f8568 100644 --- a/docker-compose-dev.yml +++ b/docker-compose-dev.yml @@ -27,6 +27,24 @@ services: - redis - mail + fittrackee_client: + container_name: fittrackee_client + environment: + - NODE_ENV=development + - REACT_APP_API_URL=http://0.0.0.0:5000 + build: + context: ./fittrackee_client + volumes: + - ./fittrackee_client:/usr/src/app + - /usr/src/app/node_modules + depends_on: + - fittrackee + ports: + - "3000:3000" + stdin_open: true + tty: true + command: /bin/sh + redis: container_name: fittrackee-redis image: "redis:latest" diff --git a/fittrackee_client/Dockerfile b/fittrackee_client/Dockerfile new file mode 100644 index 00000000..385d2557 --- /dev/null +++ b/fittrackee_client/Dockerfile @@ -0,0 +1,24 @@ +FROM node:16 + +MAINTAINER SamR1@users.noreply.github.com + +# set working directory +RUN mkdir /usr/src/app +WORKDIR /usr/src/app + +# add `/usr/src/app/node_modules/.bin` to $PATH +ENV PATH /usr/src/app/node_modules/.bin:$PATH + +# add environment variables +ARG NODE_ENV +ARG REACT_APP_API_URL +ENV NODE_ENV $NODE_ENV +ENV REACT_APP_API_URL $REACT_APP_API_URL + +# install dependencies +COPY package.json /usr/src/app/package.json +RUN yarn install --silent +RUN yarn global add react-scripts + +# copy source +COPY . /usr/src/app/