Update build-deploy.yml, Dockerfile, Dockerfile.dev, LoginFormController.jsx, docker-compose.prod.yml, and docker-compose.yml
This commit is contained in:
parent
1f9a3acc17
commit
17590cc43d
6 changed files with 8 additions and 12 deletions
2
.github/workflows/build-deploy.yml
vendored
2
.github/workflows/build-deploy.yml
vendored
|
|
@ -32,7 +32,7 @@ jobs:
|
||||||
- name: Write .env to build
|
- name: Write .env to build
|
||||||
env:
|
env:
|
||||||
DOTENV: '${{ secrets.DOTENV }}'
|
DOTENV: '${{ secrets.DOTENV }}'
|
||||||
run: echo "$DOTENV" >> .env
|
run: echo "$DOTENV" >> ./client/.env
|
||||||
- name: Build & push client image
|
- name: Build & push client image
|
||||||
uses: mr-smithers-excellent/docker-build-push@v6
|
uses: mr-smithers-excellent/docker-build-push@v6
|
||||||
with:
|
with:
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
FROM node:16-alpine as build
|
FROM node:16-alpine AS build
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
COPY ["package.json", "./"]
|
COPY ["package.json", "./"]
|
||||||
|
|
@ -10,7 +10,7 @@ COPY . .
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
|
|
||||||
FROM node:16-alpine
|
FROM node:16-alpine AS production
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
COPY --from=build /app/build ./build
|
COPY --from=build /app/build ./build
|
||||||
|
|
|
||||||
|
|
@ -11,4 +11,4 @@ COPY . .
|
||||||
|
|
||||||
EXPOSE 3000/tcp
|
EXPOSE 3000/tcp
|
||||||
|
|
||||||
CMD ["npm" "run" "start"]
|
CMD ["npm", "run", "start"]
|
||||||
|
|
@ -46,7 +46,7 @@ function LoginFormController({ setToken }) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await instance.post('/auth/login', { remember: form.remember });
|
const response = await instance.post('/auth/login', { remember: form.remember });
|
||||||
const expires = form.remember ? 365 : 1;
|
const expires = form.remember ? 365 : 1;
|
||||||
|
|
||||||
setUserData(() => response.data.user);
|
setUserData(() => response.data.user);
|
||||||
Cookies.set('token', response.data.token, { expires });
|
Cookies.set('token', response.data.token, { expires });
|
||||||
|
|
|
||||||
|
|
@ -5,14 +5,10 @@ services:
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
build:
|
build:
|
||||||
context: ./client
|
context: ./client
|
||||||
dockerfile: Dockerfile
|
|
||||||
platforms:
|
platforms:
|
||||||
- linux/amd64
|
- linux/amd64
|
||||||
- linux/arm64/v8
|
- linux/arm64/v8
|
||||||
image: c4thebomb/know-it-all-client
|
image: c4thebomb/know-it-all-client
|
||||||
env_file:
|
|
||||||
- path: .env
|
|
||||||
required: true
|
|
||||||
ports:
|
ports:
|
||||||
- 127.0.0.1:3000:3000
|
- 127.0.0.1:3000:3000
|
||||||
networks:
|
networks:
|
||||||
|
|
@ -21,8 +17,7 @@ services:
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
image: c4thebomb/know-it-all-server
|
image: c4thebomb/know-it-all-server
|
||||||
build:
|
build:
|
||||||
context: ./client
|
context: ./server
|
||||||
dockerfile: Dockerfile
|
|
||||||
platforms:
|
platforms:
|
||||||
- linux/amd64
|
- linux/amd64
|
||||||
- linux/arm64/v8
|
- linux/arm64/v8
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ services:
|
||||||
ports:
|
ports:
|
||||||
- 3000:3000
|
- 3000:3000
|
||||||
volumes:
|
volumes:
|
||||||
- ./client:/app
|
- ./client:/app1
|
||||||
- /app/node_modules
|
- /app/node_modules
|
||||||
networks:
|
networks:
|
||||||
- know-it-all
|
- know-it-all
|
||||||
|
|
@ -17,6 +17,7 @@ services:
|
||||||
REACT_APP_API_ROOT: 'http://localhost:3001/api'
|
REACT_APP_API_ROOT: 'http://localhost:3001/api'
|
||||||
REACT_APP_DOMAIN_ROOT: 'http://localhost:3000'
|
REACT_APP_DOMAIN_ROOT: 'http://localhost:3000'
|
||||||
WATCHPACK_POLLING: true
|
WATCHPACK_POLLING: true
|
||||||
|
command: npm start
|
||||||
server:
|
server:
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
build:
|
build:
|
||||||
|
|
|
||||||
Reference in a new issue