Docker - add client with react dev tools

This commit is contained in:
Sam 2021-10-16 19:22:23 +02:00
parent 9da4f60d4b
commit 8cdb61dc60
3 changed files with 54 additions and 3 deletions

View File

@ -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)

View File

@ -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"

View File

@ -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/