From 0e58c4ea1ca2abcfee7c8667dc990f3872a45e6e Mon Sep 17 00:00:00 2001 From: Azhar Date: Wed, 16 Oct 2024 13:47:00 +0300 Subject: [PATCH] fix: cd-develop and dockerfile. --- .github/workflows/cd-develop.yml | 4 ++-- packages/javascript-sdk/docker/Dockerfile | 17 +++++++++++++---- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/.github/workflows/cd-develop.yml b/.github/workflows/cd-develop.yml index 6567950..393cfc4 100644 --- a/.github/workflows/cd-develop.yml +++ b/.github/workflows/cd-develop.yml @@ -93,8 +93,8 @@ jobs: - name: Build and push Docker image uses: docker/build-push-action@v6 with: - context: . - file: ${{ env.DOCKERFILE_PATH }} + context: packages/javascript-sdk + file: docker/Dockerfile push: true tags: ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:${{ github.sha }} labels: ${{ steps.meta.outputs.labels }} diff --git a/packages/javascript-sdk/docker/Dockerfile b/packages/javascript-sdk/docker/Dockerfile index 2f1e465..e04967e 100644 --- a/packages/javascript-sdk/docker/Dockerfile +++ b/packages/javascript-sdk/docker/Dockerfile @@ -1,11 +1,20 @@ +# Stage 1: Build the application FROM node:16.5.0-alpine AS builder WORKDIR /usr/src COPY . . RUN pnpm install && pnpm build +# Stage 2: Set up Nginx to serve the built application FROM nginx:latest -COPY --from=builder /usr/src/dist/lib.js /usr/share/nginx/html +COPY --from=builder /usr/src/dist/lib.js /usr/share/nginx/html/ + +# Remove default Nginx configurations RUN rm /etc/nginx/nginx.conf && rm /etc/nginx/conf.d/default.conf -RUN ls -al -COPY nginx.conf /etc/nginx/nginx.conf -COPY default.conf /etc/nginx/conf.d/default.conf + +# Copy custom Nginx configurations +COPY docker/nginx.conf /etc/nginx/nginx.conf +COPY docker/default.conf /etc/nginx/conf.d/default.conf + +# Optional: List directory contents for debugging +RUN ls -al /etc/nginx +RUN ls -al /usr/share/nginx/html \ No newline at end of file