From ce54e96a1cc08e64f50951297f26b1e3739d9a5f Mon Sep 17 00:00:00 2001 From: Ron Rise Date: Wed, 16 Apr 2025 15:36:06 -0400 Subject: [PATCH] frontend-build (#5) Reviewed-on: https://gitea.siteworxpro.com/rrise/reloading-manager/pulls/5 Co-authored-by: Ron Rise Co-committed-by: Ron Rise --- .gitea/workflows/build.yml | 35 +++++++++++++++++++++++++++++++++-- frontend/Dockerfile | 12 ++++++++++++ 2 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 frontend/Dockerfile diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml index 35fadeb..d17cc15 100644 --- a/.gitea/workflows/build.yml +++ b/.gitea/workflows/build.yml @@ -1,11 +1,42 @@ on: - create: + push: tags: - - 'v*' + - '**' name: Build jobs: + BuildFrontend: + name: Build Frontend + runs-on: ubuntu-latest + steps: + - name: Add Siteworx CA + run: | + apt update && apt install -yq ca-certificates curl + curl -Ls https://siteworxpro.com/hosted/Siteworx+Root+CA.pem -o /usr/local/share/ca-certificates/sw.crt + update-ca-certificates + - name: Checkout code + uses: actions/checkout@v2 + with: + fetch-depth: 1 + - name: Set up Node.js + uses: actions/setup-node@v2 + with: + node-version: '22.14.0' + - name: Build Container + uses: docker/build-push-action@v6 + with: + context: ./frontend + file: ./frontend/Dockerfile + push: false + tags: siteworxpro/frontend:${{ gitea.ref_name }} + - name: Build Container + uses: docker/build-push-action@v6 + with: + context: ./frontend + file: ./frontend/Dockerfile + push: false + tags: siteworxpro/frontend:latest BuildBackend: name: Build Backend runs-on: ubuntu-latest diff --git a/frontend/Dockerfile b/frontend/Dockerfile new file mode 100644 index 0000000..a41ec99 --- /dev/null +++ b/frontend/Dockerfile @@ -0,0 +1,12 @@ +FROM node:22.14.0 AS BUILD + +WORKDIR /app + +COPY package.json package-lock.json ./ + +RUN npm install && \ + npm run build + +FROM caddy + +COPY --from=BUILD /app/dist /usr/share/caddy \ No newline at end of file