Skip to content

Commit

Permalink
refactor(server): update docker build
Browse files Browse the repository at this point in the history
  • Loading branch information
ph1p committed Nov 7, 2021
1 parent b20b50b commit a0d16bd
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
4 changes: 2 additions & 2 deletions packages/server/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ WORKDIR /usr/src/app

COPY package*.json ./

RUN npm install --only-prod
RUN yarn install --production

COPY ./dist/server.js ./dist/

CMD [ "npm", "start" ]
CMD [ "npm", "run", "start:docker" ]
2 changes: 1 addition & 1 deletion packages/server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ If you want to set another port, you can set the `PORT` environment variable.
### Docker (run inside this folder)

```bash
docker build . --tag figma-chat-server --build-arg VERSION=$(node -p -e "require('./package.json').version") && docker run -p 127.0.0.1:80:3000/tcp figma-chat-server
tsc --outDir dist && docker build . --tag figma-chat-server --build-arg VERSION=$(node -p -e "require('./package.json').version") && docker run -p 127.0.0.1:80:3000/tcp figma-chat-server
```

### Traefik
Expand Down
17 changes: 9 additions & 8 deletions packages/server/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
version: '3'

services:
web:
figmachat:
build: .
environment:
- VERSION=1.1.0
labels:
- traefik.enable=true
- traefik.port=3000
- traefik.docker.network=proxy
- traefik.frontend.rule=Host:figma-chat.ph1p.dev

- 'traefik.enable=true'
- 'traefik.http.routers.figmachat.tls'
- 'traefik.http.routers.figmachat.tls.certresolver=letsencryptresolver'
- 'traefik.http.services.figmachat.loadbalancer.server.port=80'
- 'traefik.http.routers.figmachat.rule=Host(`figma-chat.ph1p.dev`)'
- 'traefik.http.routers.figmachat.middlewares=sslheader@docker'
environment:
- PORT=80
networks:
- default
- proxy
Expand Down
1 change: 1 addition & 0 deletions packages/server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"main": "../../release/server/server.js",
"scripts": {
"start": "NODE_ENV=production node ../../release/server/server.js",
"start:docker": "NODE_ENV=production node ./dist/server.js",
"build": "tsc",
"dev": "NODE_ENV=development nodemon -e ts --exec \"tsc && node ../../release/server/server.js\"",
"lint": "echo \"not implemented\""
Expand Down

0 comments on commit a0d16bd

Please sign in to comment.