Skip to content

Commit

Permalink
build: getting the frontend build pipeline working with pnpm (#94)
Browse files Browse the repository at this point in the history
* build: getting the frontend build pipeline working with pnpm
* chore: update Dockerfile and GitHub actions
* doc: add Jessica Sachs to contributor list

A BIG THANK YOU!

---------

Co-authored-by: nanmu42 <i@nanmu.me>
  • Loading branch information
JessicaSachs and nanmu42 authored Jun 6, 2024
1 parent 5d8faad commit 9cbfb24
Show file tree
Hide file tree
Showing 11 changed files with 10,919 additions and 9,182 deletions.
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<i@nanmu.me>"
# 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
Loading

0 comments on commit 9cbfb24

Please sign in to comment.