Skip to content

Commit

Permalink
fix: fixes missing tsc dependency (#586)
Browse files Browse the repository at this point in the history
* fix: fixes missing `tsc` dependency installation in CI/CD when deploying socket.io server

* fix: updates packages and yarn.lock files

* fix: fixes yarn mismatch between local environment and docker

* fix: solves conflict with main

* fix: fixes the Dockerfile
  • Loading branch information
andreahaku authored Dec 19, 2023
1 parent f373377 commit e2773a8
Show file tree
Hide file tree
Showing 4 changed files with 218 additions and 306 deletions.
26 changes: 15 additions & 11 deletions packages/sdk-socket-server/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,26 @@ ARG NODE_ENV=production
ENV NODE_ENV=${NODE_ENV}

WORKDIR /app

# Install Yarn v3.5.1
RUN corepack enable
# RUN corepack install [email protected]
RUN corepack prepare [email protected] --activate

# Verify yarn version
RUN yarn --version

COPY package.json ./
RUN yarn install
COPY . .
RUN yarn build
COPY yarn.lock ./

# Runtime stage
FROM node:18-alpine
# Install all dependencies including devDependencies
RUN yarn install --frozen-lockfile && npm install typescript -g

WORKDIR /app
COPY --from=builder /app/package.json ./
COPY . .

# If NODE_ENV is development, install all dependencies, else only production dependencies
RUN if [ "$NODE_ENV" = "development" ]; then yarn install; else yarn install --production; fi
RUN yarn build

COPY --from=builder /app/dist ./dist
COPY .env ./

EXPOSE 4000
CMD ["node", "dist/index.js"]
CMD ["node", "dist/index.js"]
10 changes: 4 additions & 6 deletions packages/sdk-socket-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,16 @@
"lint:misc": "prettier '**/*.json' '**/*.md' '!CHANGELOG.md' --ignore-path ../../.gitignore",
"reset": "yarn clean && rimraf ./node_modules/",
"start": "yarn build && node dist/index.js",
"start:docker": "docker-compose up --build",
"start:docker:dev": "NODE_ENV=development docker-compose up --build",
"start:docker": "yarn build && docker-compose up --build",
"start:docker:dev": "yarn build && NODE_ENV=development docker-compose up --build",
"test": "jest",
"test:ci": "jest --coverage --passWithNoTests"
},
"dependencies": {
"analytics-node": "^6.2.0",
"body-parser": "^1.20.2",
"cors": "^2.8.5",
"dotenv": "^16.0.3",
"dotenv": "^16.3.1",
"express": "^4.18.2",
"helmet": "^5.1.1",
"ioredis": "^5.3.2",
Expand All @@ -51,9 +51,7 @@
"@types/analytics-node": "^3.1.13",
"@types/body-parser": "^1.19.4",
"@types/cors": "^2.8.15",
"@types/dotenv": "^8.2.0",
"@types/express": "^4.17.20",
"@types/helmet": "^4.0.0",
"@types/jest": "^29.5.6",
"@types/node": "^20.4.1",
"@types/socket.io": "^3.0.2",
Expand All @@ -69,7 +67,7 @@
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^3.4.0",
"jest": "^29.6.4",
"nodemon": "^2.0.20",
"nodemon": "^3.0.2",
"prettier": "^2.8.8",
"socket.io-client": "^4.7.2",
"supertest": "^6.3.3",
Expand Down
Loading

0 comments on commit e2773a8

Please sign in to comment.