From 3c25410b3ed036f1e6c2fdf47828ed739a628030 Mon Sep 17 00:00:00 2001 From: jejolare Date: Sun, 6 Jul 2025 19:03:43 +0700 Subject: [PATCH] docker & actions setup for dev --- .dockerignore | 3 +++ .github/workflows/dev.yml | 35 +++++++++++++++++++++++++++++++++++ Dockerfile | 6 ++++++ 3 files changed, 44 insertions(+) create mode 100644 .dockerignore create mode 100644 .github/workflows/dev.yml create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..ded222f --- /dev/null +++ b/.dockerignore @@ -0,0 +1,3 @@ +node_modules +.env +.git \ No newline at end of file diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml new file mode 100644 index 0000000..a52e906 --- /dev/null +++ b/.github/workflows/dev.yml @@ -0,0 +1,35 @@ +name: Build and Push Image to GHCR + +on: + push: + branches: + - dev + +jobs: + build-and-push: + runs-on: ubuntu-latest + + permissions: + contents: read + packages: write + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to GHCR + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push to GHCR + uses: docker/build-push-action@v5 + with: + context: . + push: true + tags: ghcr.io/${{ github.repository }}:dev diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..0c74bbd --- /dev/null +++ b/Dockerfile @@ -0,0 +1,6 @@ +FROM node:21-alpine +WORKDIR /app +COPY package*.json ./ +RUN npm ci +COPY . . +CMD ["npx", "tsx", "src/server.ts"] \ No newline at end of file