Skip to content

Commit

Permalink
docs(example): add example implementation of cli for cra
Browse files Browse the repository at this point in the history
  • Loading branch information
JoseVSeb committed Feb 13, 2024
1 parent 5ad0bd4 commit 864d09a
Show file tree
Hide file tree
Showing 23 changed files with 14,537 additions and 75 deletions.
8 changes: 8 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
*.yaml
*.txt
*.png
*.sh
*.html
*.ico
Dockerfile
*.json
1 change: 0 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"plugin:prettier/recommended"
],
"plugins": ["@typescript-eslint"],
"ignorePatterns": ["pnpm-lock.yaml"],
"rules": {
"prefer-const": "error",
"no-unused-vars": "off",
Expand Down
4 changes: 4 additions & 0 deletions examples/cra/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*.env*
node_modules
.*
build
1 change: 1 addition & 0 deletions examples/cra/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
REACT_APP_SAMPLE_ENV = "This is for development server."
23 changes: 23 additions & 0 deletions examples/cra/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
21 changes: 21 additions & 0 deletions examples/cra/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM node:20-alpine as base
RUN npm i -g pnpm

FROM base as builder
WORKDIR /workspace
COPY package.json pnpm-lock.yaml ./
RUN pnpm i --frozen-lockfile
RUN mkdir ./public
COPY public/* ./public
RUN mkdir ./src
COPY src/* ./src
COPY tsconfig.json .
RUN pnpm build

FROM base as runner
WORKDIR /app
RUN npm i -g serve runtime-env-cli
COPY --from=builder /workspace/build .
COPY scripts/start_server.sh .
RUN chmod +x start_server.sh
ENTRYPOINT [ "./start_server.sh" ]
9 changes: 9 additions & 0 deletions examples/cra/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
version: "3.8"
services:
visualizer:
build:
context: .
ports:
- "3000:3000"
environment:
- REACT_APP_SAMPLE_ENV=injected from docker compose
39 changes: 39 additions & 0 deletions examples/cra/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"name": "runtime-env-cli-examples-cra",
"version": "0.0.0",
"private": true,
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"dependencies": {
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"@types/node": "^20.11.17",
"@types/react": "^18.2.55",
"@types/react-dom": "^18.2.19",
"react-scripts": "5.0.1",
"runtime-env-cli": "1.0.0-alpha.3",
"typescript": "^5.3.3"
}
}
Loading

0 comments on commit 864d09a

Please sign in to comment.