Skip to content

Commit

Permalink
Merge pull request #4 from dekiakbar/dev
Browse files Browse the repository at this point in the history
fix deployment, run npm install at deployment
  • Loading branch information
Deki authored Aug 27, 2022
2 parents cbc3e16 + 39e30c1 commit bc80ed0
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 59 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM node:gallium-slim

WORKDIR /app
COPY . /app
ADD ./ /app
RUN npm i -g @nestjs/cli
USER node
108 changes: 51 additions & 57 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,87 +6,81 @@ Image Optimizer Backend is a application for [image optimizer frontend](https://

### Backend (this repo)
- #### Without docker
- ```bash
# Clone this repository
git clone https://github.com/dekiakbar/image-optimizer
```

- ```bash
# Navigate to project dir
cd image-optimizer
```
# Clone this repository
git clone https://github.com/dekiakbar/image-optimizer
```

- ```bash
# Install node modules and dependencies
npm install
# Navigate to project dir
cd image-optimizer
```

- ```bash
# Run app
# Install node modules and dependencies
npm install
```

# development
$ npm run start
# Watch mode
$ npm run start:dev
# production mode
$ npm run start:prod
```
- ```bash
# Run app
# development
$ npm run start
# Watch mode
$ npm run start:dev
# production mode
$ npm run start:prod
```

- ```bash
# access swager api
http://localhost:3000
```
# access swager api
http://localhost:3000
```

- #### Docker
- ```bash
# Clone this repository
git clone https://github.com/dekiakbar/image-optimizer
```

- ```bash
# Navigate to project dir
cd image-optimizer
```
# Clone this repository
git clone https://github.com/dekiakbar/image-optimizer
```

- ```bash
# Build image and start container
docker-compose run --rm node npm install --legacy-peer-deps
```
# Navigate to project dir
cd image-optimizer
```

- ```bash
# Build image and start container
docker-compose up -d
```
# Build image and start container
docker-compose up -d
```

- ```bash
# access swager api
http://localhost:3000
```

# access swager api
http://localhost:3000
```
- #### NOTE : if you wanna run npm command, please use this.
```bash
docker-compose run --rm node npm install --legacy-peer-deps
```
## Deployment
- #### Docker
- ```bash
# Clone this repository
git clone https://github.com/dekiakbar/image-optimizer
```
# Clone this repository
git clone https://github.com/dekiakbar/image-optimizer
```

- ```bash
# Navigate to project dir
cd image-optimizer
```

- ```bash
# Build image and start container
docker-compose run --rm node npm install --legacy-peer-deps
```

# Navigate to project dir
cd image-optimizer
```

- ```bash
# Build image and start container
docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d
```

# Build image and start container
docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d
```
## Environment Variable

Copy `env.example` to `.env`
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.prod.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: "3"
services:
node:
command: bash -c "npm run build && npm run start:prod"
command: bash -c "npm install --legacy-peer-deps && npm run build && npm run start:prod"

0 comments on commit bc80ed0

Please sign in to comment.