diff --git a/.github/workflows/build-and-deploy.yml b/.github/workflows/build-and-deploy.yml index e60358b..a52e0e8 100644 --- a/.github/workflows/build-and-deploy.yml +++ b/.github/workflows/build-and-deploy.yml @@ -11,6 +11,18 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 + - name: Prebuild - install node + uses: actions/setup-node@v3 + with: + node-version: "20" + - name: Prebuild - install dependencies + run: npm install + - name: Prebuild - generate grammar + run: npm run generate-grammar-prod + - name: Prebuild - build app + run: npm run build + - name: Prebuild - cleanup + run: rm -rf node_modules - name: Set up QEMU uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx @@ -27,3 +39,6 @@ jobs: platforms: linux/amd64,linux/arm64 push: true tags: kuzudb/kuzu-ui:latest + build-args: | + SKIP_GRAMMAR=true + SKIP_BUILD_APP=true diff --git a/Dockerfile b/Dockerfile index 0e77333..f840f33 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,16 @@ -FROM ubuntu:22.04 +FROM debian:bookworm-slim + +ARG SKIP_GRAMMAR=false +ARG SKIP_BUILD_APP=false + +ENV DEBIAN_FRONTEND=noninteractive +RUN echo "SKIP_GRAMMAR: $SKIP_GRAMMAR" +RUN echo "SKIP_BUILD_APP: $SKIP_BUILD_APP" # Install dependencies RUN apt-get update -RUN apt-get install -y openjdk-17-jdk ca-certificates curl gnupg +RUN apt-get install -y ca-certificates curl gnupg +RUN if [ "$SKIP_GRAMMAR" != "true" ] ; then apt-get install -y openjdk-17-jdk ; else echo "Skipping openjdk installation as grammar generation is skipped" ; fi RUN mkdir -p /etc/apt/keyrings RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg RUN echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list @@ -32,10 +40,10 @@ WORKDIR /home/appuser/app RUN npm install # Generate grammar -RUN npm run generate-grammar-prod +RUN if [ "$SKIP_GRAMMAR" != "true" ] ; then npm run generate-grammar-prod ; else echo "Skipping grammar generation" ; fi # Build app -RUN npm run build +RUN if [ "$SKIP_BUILD_APP" != "true" ] ; then npm run build ; else echo "Skipping build" ; fi # Expose port EXPOSE 8000