diff --git a/.env.example b/.env.example index f76ede7..d2e999b 100644 --- a/.env.example +++ b/.env.example @@ -1,4 +1,6 @@ NODE_ENV="development" DATABASE_URL="" CLERK_SECRET_KEY="" -VITE_CLERK_PUBLISHABLE_KEY="" +CLERK_PUBLISHABLE_KEY="" +CLERK_WEBHOOK_SECRET="" +CONTAINER_REGISTRY="" diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index ff98330..ca324ca 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -63,7 +63,7 @@ jobs: username: ${{ secrets.REGISTRY_USERNAME }} password: ${{ secrets.REGISTRY_PASSWORD }} - - name: 🗄️ Build and Push App to Container Registry + - name: 🗄️ Build and Push to Container Registry uses: docker/build-push-action@v5 with: context: . @@ -74,14 +74,6 @@ jobs: build-args: | DATABASE_URL=${{ secrets.PROD_DATABASE_URL }} - - name: 🗄️ Build and Push Migration Image to Container Registry - uses: docker/build-push-action@v5 - with: - context: . - file: ./Dockerfile.migrate - push: true - tags: ${{ vars.CONTAINER_REGISTRY }}/brackt-migrate:latest - # This ugly bit is necessary if you don't want your cache to grow forever # till it hits GitHub's limit of 10GB. # Temp fix @@ -116,6 +108,4 @@ jobs: docker login $CONTAINER_REGISTRY -u $REGISTRY_USERNAME -p $REGISTRY_PASSWORD cd brackt docker compose pull - docker pull $CONTAINER_REGISTRY/brackt-migrate:latest - docker run --rm --env-file .env $CONTAINER_REGISTRY/brackt-migrate:latest docker compose up -d diff --git a/Dockerfile b/Dockerfile index d7526ff..ece5e88 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,5 +18,8 @@ FROM node:20-alpine COPY ./package.json package-lock.json server.js /app/ COPY --from=production-dependencies-env /app/node_modules /app/node_modules COPY --from=build-env /app/build /app/build +COPY ./drizzle /app/drizzle +COPY ./drizzle.config.ts /app/drizzle.config.ts +COPY ./database /app/database WORKDIR /app -CMD ["npm", "run", "start"] \ No newline at end of file +CMD ["npm", "run", "start:production"] \ No newline at end of file diff --git a/Dockerfile.migrate b/Dockerfile.migrate deleted file mode 100644 index 90a5a1c..0000000 --- a/Dockerfile.migrate +++ /dev/null @@ -1,13 +0,0 @@ -FROM node:20-alpine AS dependencies -COPY ./package.json package-lock.json /app/ -WORKDIR /app -RUN npm ci --omit=dev - -FROM node:20-alpine -COPY ./package.json package-lock.json /app/ -COPY --from=dependencies /app/node_modules /app/node_modules -COPY ./drizzle /app/drizzle -COPY ./drizzle.config.ts /app/drizzle.config.ts -COPY ./database /app/database -WORKDIR /app -CMD ["npx", "drizzle-kit", "migrate"] diff --git a/package.json b/package.json index b06b789..f82b5de 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,7 @@ "db:migrate": "dotenv -- drizzle-kit migrate", "dev": "dotenv -- node server.js", "start": "node server.js", + "start:production": "drizzle-kit migrate && rm -rf drizzle drizzle.config.ts database && node server.js", "typecheck": "react-router typegen && tsc -b" }, "dependencies": {