diff --git a/.github/workflows/web.yaml b/.github/workflows/web.yaml index 1f3ce74d..b9022ebe 100644 --- a/.github/workflows/web.yaml +++ b/.github/workflows/web.yaml @@ -66,7 +66,7 @@ jobs: password: ${{ secrets.DOCKER_PASSWORD }} - name: Build Docker image - run: docker build -t keyshade/keyshade-web:latest -f Dockerfile-web . + run: docker build -t keyshade/keyshade-web:latest -f ./apps/web/Dockerfile . - name: Push Docker image run: docker push keyshade/keyshade-web diff --git a/apps/api/.dockerignore b/apps/api/.dockerignore new file mode 100644 index 00000000..40b878db --- /dev/null +++ b/apps/api/.dockerignore @@ -0,0 +1 @@ +node_modules/ \ No newline at end of file diff --git a/apps/api/Dockerfile b/apps/api/Dockerfile new file mode 100644 index 00000000..27a7d788 --- /dev/null +++ b/apps/api/Dockerfile @@ -0,0 +1,19 @@ +FROM node:20-alpine as build + +WORKDIR /app + +RUN npm i -g pnpm + +COPY package.json . +COPY tsconfig.base.json . + +RUN pnpm install + +COPY apps/api apps/api + +RUN pnpm run db:generate-types +RUN pnpm run build:api + +EXPOSE 4200 + +ENTRYPOINT ["pnpm", "run", "start:api"] \ No newline at end of file diff --git a/apps/web/.dockerignore b/apps/web/.dockerignore new file mode 100644 index 00000000..40b878db --- /dev/null +++ b/apps/web/.dockerignore @@ -0,0 +1 @@ +node_modules/ \ No newline at end of file diff --git a/Dockerfile-web b/apps/web/Dockerfile similarity index 100% rename from Dockerfile-web rename to apps/web/Dockerfile diff --git a/package.json b/package.json index e3339e7e..734ae778 100644 --- a/package.json +++ b/package.json @@ -29,6 +29,7 @@ "test:cli": "nx run cli:test", "test:sdk-node": "nx run sdk-js:test", "start:web": "nx run web:serve --configuration=production", + "start:api": "nx run api:serve --configuration=production", "db:seed": "cd apps/api/src/prisma && pnpx ts-node seed.ts", "db:generate-types": "nx run api:prisma:generate", "db:generate-migrations": "cd apps/api/src/prisma && pnpx prisma migrate dev --create-only --skip-seed",