Skip to content

Commit

Permalink
ci: add build frontend (#78)
Browse files Browse the repository at this point in the history
* ci: add build frontend

* subdir

* copy

* skip musl

* copy

* all

* setenv
  • Loading branch information
vnghia authored Apr 13, 2024
1 parent 705bbe3 commit d544770
Show file tree
Hide file tree
Showing 7 changed files with 1,379 additions and 61 deletions.
36 changes: 35 additions & 1 deletion .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,40 @@ env:
DATABASE_URL: "postgres://postgres:postgres@localhost:5432/postgres"

jobs:
build-frontend:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_TOOLCHAIN }}

- uses: actions/setup-node@v4
with:
node-version: 20
cache: "npm"
cache-dependency-path: ${{ github.workspace }}/frontend/package-lock.json
- name: Build tailwindcss
working-directory: ${{ github.workspace }}/frontend
run: |
npm ci
npm run build
- name: Install dioxus-cli
uses: taiki-e/cache-cargo-install-action@v1
with:
tool: dioxus-cli
- name: Build frontend
run: |
dx build --verbose
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: frontend
path: ${{ github.workspace }}/frontend/dist/
retention-days: 1

build-linux:
strategy:
fail-fast: false
Expand Down Expand Up @@ -138,7 +172,7 @@ jobs:

build-docker:
runs-on: ubuntu-latest
needs: build-linux
needs: [build-frontend, build-linux]
if: ${{ vars.BUILD_DOCKER != '' }}

steps:
Expand Down
2 changes: 2 additions & 0 deletions ci/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,6 @@ RUN chmod +x /artifact/nghe

FROM ${BASE_IMAGE}
COPY --from=artifact /artifact/nghe /app/nghe
COPY --from=artifact /artifact/frontend/ /app/frontend/
ENV NGHE_SERVER__FRONTEND_DIR="/app/frontend/"
ENTRYPOINT [ "/app/nghe" ]
Loading

0 comments on commit d544770

Please sign in to comment.