Skip to content

Commit

Permalink
Try to improve build performance for deployment (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
mewim authored Oct 10, 2023
1 parent aef9fca commit 63d17fc
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 4 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/build-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
16 changes: 12 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 63d17fc

Please sign in to comment.