diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml new file mode 100644 index 00000000..3f53646d --- /dev/null +++ b/.github/workflows/docker-image.yml @@ -0,0 +1,18 @@ +name: Docker Image CI + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Build the Docker image + run: docker build . --file Dockerfile --tag my-image-name:$(date +%s) diff --git a/Dockerfile b/Dockerfile index 7a33e32f..56ee8ffe 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,11 +10,20 @@ COPY package*.json ./ # Install dependencies RUN npm install +# Copy Prisma schema first +COPY prisma ./prisma + +# Generate Prisma Client +RUN npx prisma generate + # Copy the rest of the application code COPY . . +# Prevent SWC binary download crash +ENV NEXT_DISABLE_SWC_DOWNLOAD=1 + # Generate Database -RUN npx prisma migrate dev --name init +#RUN npx prisma migrate dev --name init # Build the Next.js application RUN npm run build