Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: getting the frontend build pipeline working with pnpm #94

Merged
merged 3 commits into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,25 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 16.15.1
node-version: 20.13.1

- name: Set up PNPM
uses: pnpm/action-setup@v4
with:
version: 9

- name: Build Frontend
run: make frontend

- name: Set up Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: 1.x
go-version: stable

- name: Get dependencies
run: go get ./...
Expand All @@ -29,6 +34,6 @@ jobs:
run: make rly

- name: golangci-lint
uses: golangci/golangci-lint-action@v3
uses: golangci/golangci-lint-action@v6
with:
version: latest
2 changes: 1 addition & 1 deletion .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Build, tag, and push
env:
DOCKER_HUB_REPO: nanmu42/orly
Expand Down
13 changes: 6 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
FROM golang:alpine3.17 as golang
RUN apk --no-cache add make git tar tzdata ca-certificates nodejs=16.15.1 yarn wget
FROM golang:alpine3.20 as golang
RUN apk --no-cache add make git tar tzdata ca-certificates nodejs=20.13.1-r0 wget xz
RUN wget -qO /bin/pnpm "https://github.com/pnpm/pnpm/releases/latest/download/pnpm-linuxstatic-x64" && chmod +x /bin/pnpm

WORKDIR /app
COPY . .
RUN mkdir -p assets && \
cd assets && \
wget -nc https://github.com/nanmu42/orly/releases/download/1.5.0-beta/cover-images.tar.xz && \
wget -nc https://github.com/nanmu42/orly/releases/download/1.1.0-beta/fonts.tar.xz
RUN make assets
RUN make all

FROM alpine:3.17
FROM alpine3.20
# Maintainer Info
LABEL maintainer="nanmu42<[email protected]>"
# Dependencies
Expand Down
14 changes: 10 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ dir:
mkdir -p bin/fonts && \
mkdir -p bin/cover-images

assets:
mkdir -p assets && \
cd assets && \
wget -nc https://github.com/nanmu42/orly/releases/download/1.5.0-beta/cover-images.tar.xz && \
wget -nc https://github.com/nanmu42/orly/releases/download/1.1.0-beta/fonts.tar.xz

clean:
rm -rf bin

Expand All @@ -21,20 +27,20 @@ config: dir

frontend: dir
cd frontend && \
yarn install && yarn build && \
pnpm install && pnpm build && \
cp -r dist/* $(PWD)/bin/web

rly: rly.bin

fonts: dir
fonts: dir assets
cd assets && \
tar -xf fonts.tar.xz --skip-old-files -C $(PWD)/bin/fonts

covers: dir
covers: dir assets
cd assets && \
tar -xf cover-images.tar.xz --skip-old-files -C $(PWD)/bin/cover-images

%.bin: dir
cd cmd/$* && \
CGO_ENABLED=0 go build -trimpath -ldflags "-s -w -X main.Version=$(VERSION) -X main.BuildDate=$(BUILD)" && \
cp $* $(PWD)/bin/$*
cp $* $(PWD)/bin/$*
7 changes: 2 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,7 @@ Save as `rly.toml`, mount it into `/app/config`, and run docker image with param
O'RLY can be built in following commands:

```bash
mkdir -p assets
cd assets
wget -nc https://github.com/nanmu42/orly/releases/download/1.5.0-beta/cover-images.tar.xz
wget -nc https://github.com/nanmu42/orly/releases/download/1.1.0-beta/fonts.tar.xz
cd ..
make assets
make all
```

Expand Down Expand Up @@ -91,6 +87,7 @@ Many thanks :hugs: to following contributors:
* [TahsinGokalp](https://github.com/TahsinGokalp) (Turkish translation)
* [wooogi123](https://github.com/wooogi123) (Korean translation)
* [cauldnz](https://github.com/cauldnz) (Adding new animal)
* [Jessica Sachs](https://github.com/JessicaSachs) (Project maintainer!)

# Projects in Brotherhood

Expand Down
1 change: 1 addition & 0 deletions README_ZH.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ O'RLY 是一个简易的API服务和静态前端的组合:
* [TahsinGokalp](https://github.com/TahsinGokalp) (土耳其语翻译)
* [wooogi123](https://github.com/wooogi123) (韩语翻译)
* [cauldnz](https://github.com/cauldnz) (新增动物)
* [Jessica Sachs](https://github.com/JessicaSachs) (项目维护者!)

# 兄弟项目

Expand Down
2 changes: 2 additions & 0 deletions frontend/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node-options=--openssl-legacy-provider
node-linker=hoisted
Copy link
Owner

@nanmu42 nanmu42 May 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I add this to address building issues on Linux.

Feel free to change it if you happen to have a better solution. :D

Loading