Skip to content

Commit 1da1bf3

Browse files
committed
fixes for deployement
1 parent f647489 commit 1da1bf3

File tree

5 files changed

+55
-4
lines changed

5 files changed

+55
-4
lines changed

.github/workflows/publish.yml

+44-1
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,40 @@ on:
66
workflow_dispatch:
77

88
jobs:
9+
build-frontend:
10+
runs-on: ubuntu-latest
11+
if: github.event_name != 'pull_request'
12+
permissions:
13+
contents: read
14+
id-token: write
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
- name: "Install Rust Toolchain"
19+
uses: actions-rs/toolchain@v1
20+
with:
21+
toolchain: stable
22+
- name: "Install Node"
23+
uses: actions/setup-node@v3
24+
with:
25+
node-version: 20
26+
- run: rustup target add wasm32-unknown-unknown
27+
working-directory: frontend
28+
- run: npm i
29+
working-directory: frontend
30+
- run: npm run wasm
31+
working-directory: frontend
32+
- run: npm run build
33+
working-directory: frontend
34+
- name: Upload built files
35+
uses: actions/upload-artifact@v3
36+
with:
37+
name: built-frontend
38+
path: ./frontend/dist
39+
940
publish-images:
1041
runs-on: ubuntu-latest
42+
needs: build-frontend
1143
if: github.event_name != 'pull_request'
1244
permissions:
1345
contents: read
@@ -18,9 +50,19 @@ jobs:
1850
service_name:
1951
- "backend"
2052
- "frontend"
53+
include:
54+
- service_name: backend
55+
docker_file: backend/Dockerfile
56+
- service_name: frontend
57+
docker_file: frontend/Dockerfile.pre-built
2158
steps:
2259
- name: Checkout
23-
uses: actions/checkout@v3
60+
uses: actions/checkout@v4
61+
- name: Download built files
62+
uses: actions/download-artifact@v3
63+
with:
64+
name: built-frontend
65+
path: ./frontend/dist
2466
- name: Docker meta
2567
id: meta
2668
uses: docker/metadata-action@v4
@@ -46,6 +88,7 @@ jobs:
4688
uses: docker/build-push-action@v4
4789
with:
4890
context: ./${{ matrix.service_name }}
91+
file: ${{ matrix.docker_file }}
4992
platforms: linux/amd64,linux/arm64
5093
push: ${{ github.event_name != 'pull_request' }}
5194
tags: ${{ steps.meta.outputs.tags }}

frontend/Dockerfile

+5-3
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@ FROM node:20-bullseye as builder
55
WORKDIR /app
66

77
RUN \
8-
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh \
9-
&& \
10-
rustup target add wasm32-unknown-unknown
8+
curl --proto '=https' --tlsv1.2 -sSf --output /tmp/rustup https://sh.rustup.rs && \
9+
chmod +x /tmp/rustup && \
10+
bash /tmp/rustup -y
11+
ENV PATH="$PATH:/root/.cargo/bin"
12+
RUN rustup target add wasm32-unknown-unknown
1113

1214
COPY package.json package-lock.json ./
1315

File renamed without changes.

frontend/Dockerfile.pre-built

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
FROM nginxinc/nginx-unprivileged:stable-alpine
2+
3+
COPY --link dist/ /usr/share/nginx/html/
4+
COPY --link nginx.conf /etc/nginx/conf.d/default.conf
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules
2+
pnpm-lock.yaml

0 commit comments

Comments
 (0)