Skip to content

Commit ecd0176

Browse files
committed
modified README
1 parent 65d3118 commit ecd0176

File tree

1 file changed

+18
-24
lines changed

1 file changed

+18
-24
lines changed

README.md

Lines changed: 18 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ A runtime environment handler for React.js apps that have been bootstraped using
66
- [Requirements](#requirements)
77
- [CLI Options](#cli-options)
88
- [Using in a Typescript app](#typescript-usage)
9-
- [Usage in docker](#usage-in-docker)
9+
- [Usage in Docker](#usage-in-docker)
10+
- [Examples](#examples)
1011

1112
## Usage
1213

@@ -90,35 +91,28 @@ declare global {
9091

9192
## Usage in Docker
9293

93-
You must have an example of your `.env` layout. A project usually have a `.env.example` which represents that. Inside a docker container we can lean on the `.env.example`. **Make sure your `.env.example` is always represents the correct format!**
94+
You must have an example of your `env` layout. A project usually have a `.env.example` which represents that and will not contain any sensitive information.
95+
Inside a docker container we can lean on the `.env.example`. **Make sure your `.env.example` is always up to date!**
9496

95-
```Dockerfile
96-
# build
97-
FROM node:12.13.0-alpine as build
98-
99-
WORKDIR /usr/src/app
100-
101-
COPY package* ./
102-
COPY . .
103-
104-
RUN npm i
105-
RUN npm run build
97+
- Using in an alpine based container
10698

107-
# release
108-
FROM nginx:stable-alpine as release
109-
110-
COPY --from=build /usr/src/app/build /usr/share/nginx/html
111-
COPY --from=build /usr/src/app/scripts /usr/share/nginx/html/scripts
112-
COPY --from=build /usr/src/app/.env.example /usr/share/nginx/html/.env
113-
COPY --from=build /usr/src/app/nginx/default.conf /etc/nginx/conf.d/default.conf
99+
```Dockerfile
100+
# copy .env.example as .env to the container
101+
COPY .env.example .env
114102

103+
# install bash, nodejs & npm
104+
RUN apk add --no-cache bash
115105
RUN apk add --update nodejs
106+
RUN apk add --update npm
116107

108+
# install runtime-env-cra package
117109
RUN npm i -g runtime-env-cra
118110

119-
WORKDIR /usr/share/nginx/html
111+
# start the app with the following CMD
112+
CMD ["/bin/bash", "-c", "runtime-env-cra && nginx -g \"daemon off;\""]
113+
```
120114

121-
EXPOSE 80
115+
## Examples
122116

123-
CMD ["runtime-env-cra && nginx -g \"daemon off;\""]
124-
```
117+
- Create react app with typescript template, including Dockerfile and docker-compose. ([source](/examples/runtime-env-example-ts))
118+
- Create react app without typescript, including Dockerfile and docker-compose. ([source](/examples/runtime-env-example-js))

0 commit comments

Comments
 (0)