Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,10 @@ $ npm run dev
```

The service should be reachable under http://localhost:1337.

## Build image
```bash
$ VERSION=0.1.0
$ docker build -f ./docker/prod/Dockerfile -t slvctrlplus/server:$VERSION .
$ docker push slvctrlplus/server:$VERSION
```
2 changes: 1 addition & 1 deletion docker/dev/node/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:14-alpine
FROM node:18-alpine

RUN apk --no-cache upgrade && \
apk --no-cache add bash git sudo openssh make
Expand Down
23 changes: 23 additions & 0 deletions docker/prod/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM node:18-alpine
WORKDIR /usr/app
COPY package.json yarn.lock tsconfig.json ./
COPY src ./src
RUN ls -a
RUN yarn install
RUN yarn run build

FROM node:18-alpine

# Create app directory
WORKDIR /usr/app

ENV PORT 1337

RUN apk add --no-cache eudev

COPY package.json yarn.lock ./
RUN yarn install --frozen-lockfile --prod
COPY --from=0 /usr/app/dist .
RUN yarn global add pm2 --prod
EXPOSE 1337
CMD ["pm2-runtime","index.js"]
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
"typescript": "^4.7.1-rc"
},
"scripts": {
"build": "tsc",
"compile": "tsc && node dist/index.js",
"dev": "nodemon",
"test": "jest",
Expand Down
2 changes: 1 addition & 1 deletion src/device/deviceManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export default class DeviceManager extends EventEmitter
const ports = await SerialPort.list();

for (const portInfo of ports) {
if (!portInfo.path.startsWith('/dev/tty.usb') || '' === portInfo.serialNumber) {
if (undefined === portInfo.serialNumber || '' === portInfo.serialNumber) {
continue;
}

Expand Down