Skip to content

Commit

Permalink
updated readmes
Browse files Browse the repository at this point in the history
Signed-off-by: Cristian Gonzalez <[email protected]>
  • Loading branch information
cristianglezm committed Nov 15, 2023
1 parent 3bec5d5 commit 6a2b3b8
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 12 deletions.
13 changes: 8 additions & 5 deletions README-Docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ for production you will need to change the .env file and configure ssl.
## Docker compose ##

The frontend image must be built as it is a SPA and it needs to be configured.
if you are on windows you might need to run dos2unix rewrite_env.sh

You will need to change these environment variables:

Expand Down Expand Up @@ -37,17 +38,19 @@ Change the arg and environment variables: backend and NGINX_HOST to domain name.
NGINX_HOST: localhost # domain name
NGINX_RESOLVER: 127.0.0.11 # dns for docker

the [compose file](https://github.com/cristianglezm/FlowerEvolver-frontend/docker-compose.yml)
the [compose file](https://github.com/cristianglezm/FlowerEvolver-frontend/blob/master/docker-compose.yml)

## Frontend ##

The frontend image must be built as it is a SPA and it needs to be configured.

You can build the image running the following command after cloning the repo, change the environment variables as needed.

* docker build -t cristianglezm/fe:frontend-alpine-dev -f dockerfile.alpine \
--build-arg "REWRITE_ENV=TRUE" --build-arg "BASE_URL='/'" --build-arg BACKEND="http://localhost"
* docker run -dp 80:80 -v logs:/var/log/nginx cristianglezm/fe:frontend-alpine-dev -e "API=localhost:5000"
```bash
docker build -t cristianglezm/fe:frontend-alpine-dev -f dockerfile.alpine \
--build-arg "REWRITE_ENV=TRUE" --build-arg "BASE_URL='/'" --build-arg BACKEND="http://localhost" .
docker run -dp 80:80 -v logs:/var/log/nginx cristianglezm/fe:frontend-alpine-dev -e "API=localhost:5000"
```

## Backend ##

Expand Down Expand Up @@ -84,4 +87,4 @@ As with all Docker images, these likely also contain other software which may be
along with any direct or indirect dependencies of the primary software being contained).

As for any pre-built image usage, it is the image user's responsibility to ensure that any use of this image
complies with any relevant licenses for all software contained within.
complies with any relevant licenses for all software contained within.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ The frontend image must be built as it is a SPA and it needs to be configured.

You can build the image running the following command after cloning the repo, change the environment variables as needed.

* docker build -t cristianglezm/fe:frontend-alpine-dev -f dockerfile.alpine \
--build-arg "REWRITE_ENV=TRUE" --build-arg "BASE_URL='/'" --build-arg BACKEND="http://localhost"
* docker run -dp 80:80 -v logs:/var/log/nginx cristianglezm/fe:frontend-alpine-dev -e "API=localhost:5000"
```bash
docker build -t cristianglezm/fe:frontend-alpine-dev -f dockerfile.alpine \
--build-arg "REWRITE_ENV=TRUE" --build-arg "BASE_URL='/'" --build-arg BACKEND="http://localhost" .
docker run -dp 80:80 -v logs:/var/log/nginx cristianglezm/fe:frontend-alpine-dev -e "API=localhost:5000"
````

more info [here](README-Docker.md)

Expand Down
4 changes: 2 additions & 2 deletions dockerfile.alpine
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ WORKDIR /app
ARG REWRITE_ENV
ARG BACKEND
ARG BASE_URL
RUN sh rewrite_env.sh && \
npm install && \
RUN sh rewrite_env.sh && \
npm ci && \
npm run build

FROM nginx:stable-alpine as frontend
Expand Down
4 changes: 2 additions & 2 deletions rewrite_env.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh

echo "running rewrite_env.sh"
if [ "$REWRITE_ENV" = "true" ]
if [ "$REWRITE_ENV" == "true" ]
then
echo "Building .env file"
echo "BACKEND=$BACKEND" > .env
Expand All @@ -11,4 +11,4 @@ then
echo "VITE_APP_BASE_URL=$BASE_URL" >> .env
fi
echo "Using these values from .env to build frontend:"
cat .env
cat .env

0 comments on commit 6a2b3b8

Please sign in to comment.