Skip to content

Commit

Permalink
ci: add build script
Browse files Browse the repository at this point in the history
  • Loading branch information
thuongtruong109 committed Jul 21, 2024
1 parent bbb249c commit be068af
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 13 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Build image
on:

push:
branches:
- main

jobs:
publish:
runs-on: "ubuntu-20.04"

steps:
- uses: actions/checkout@v2

- name: Build and publish a Docker image for ${{ github.repository }}
uses: macbre/push-to-ghcr@master
with:
image_name: ${{ github.repository }}
github_token: ${{ secrets.GITHUB_TOKEN }}
6 changes: 1 addition & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@ COPY . .

COPY tsconfig.json ./

RUN npm run build

RUN ls

EXPOSE 3000

CMD ["npm", "run", "start"]
CMD ["npm", "run", "dev"]
7 changes: 3 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@ version: "3.7"

services:
app:
container_name: sharemate
image: thuongtruong1009/shakemate
container_name: shakemate
build:
context: .
dockerfile: Dockerfile
ports:
# - "3000:3000"
- "127.0.0.1:3000:3000"
# - "0.0.0.0:3000:3000"
- "3000:3000"
volumes:
- .:/app
6 changes: 3 additions & 3 deletions src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ const server = fastify({ logger: true });
fastify.get('/ws', { websocket: true }, handleWS(server.log));
});

// server.listen({ port: 3000, host: '127.0.0.1' });
server.listen({ port: 3000 }, (err, address) => {

server.listen({ port: 3000, host: '0.0.0.0' }, (err) => {
if (err) {
console.error(err)
process.exit(1)
}
console.log(`Server listening at ${address}`)
console.log('Server listening at http://localhost:3000')
})
} catch (err) {
server.log.error(err);
Expand Down
1 change: 0 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
"resolveJsonModule": true,
"sourceMap": false,
"outDir": "./dist",
// "baseUrl": ".",
"rootDir": ".",
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
Expand Down

0 comments on commit be068af

Please sign in to comment.