Skip to content

Commit

Permalink
setup docker build
Browse files Browse the repository at this point in the history
  • Loading branch information
ananthakumaran committed Sep 25, 2023
1 parent 486f5de commit c012772
Show file tree
Hide file tree
Showing 9 changed files with 231 additions and 148 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Release Docker Image
on:
push:
branches:
- ci/docker-*
tags:
- '*'
jobs:
docker:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- id: meta
uses: docker/metadata-action@v5
with:
images: ananthakumaran/paisa
- uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
file: ./Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
47 changes: 47 additions & 0 deletions .github/workflows/linux-app.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Linux App Release

on:
push:
branches:
- ci/linux-app-*
tags:
- '*'

jobs:
linux-app-binary:
runs-on: ubuntu-22.04
steps:
- uses: actions/[email protected]
- uses: cachix/install-nix-action@v22
with:
nix_path: nixpkgs=channel:nixos-unstable
- uses: actions/setup-node@v3
with:
node-version: 18
cache: npm
- uses: actions/setup-go@v4
with:
go-version: '1.20.5'
- run: |
sudo apt-get install -y sqlite3 libgtk-3-dev libwebkit2gtk-4.0-dev build-essential pkg-config
npm install
npm run build
nix-build ledger.nix
cp ./result/bin/ledger internal/binary/ledger
cd desktop
go install github.com/wailsapp/wails/v2/cmd/wails@latest
wails doctor
wails build -tags webkit2_40
cp build/bin/Paisa build/linux/usr/local/bin
cp -r build/linux paisa_0.5.2_amd64
dpkg --build paisa_0.5.2_amd64
cd ..
mv desktop/paisa_0.5.2_amd64.deb paisa-app-linux-amd64.deb
- name: Release
uses: softprops/action-gh-release@v1
with:
draft: true
files: |
paisa-*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40 changes: 40 additions & 0 deletions .github/workflows/linux-cli.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Linux CLI Release

on:
push:
branches:
- ci/linux-cli-*
tags:
- '*'

jobs:
linux-cli-binary:
runs-on: ubuntu-20.04
steps:
- uses: actions/[email protected]
- uses: cachix/install-nix-action@v22
with:
nix_path: nixpkgs=channel:nixos-unstable
- uses: actions/setup-node@v3
with:
node-version: 18
cache: npm
- uses: actions/setup-go@v4
with:
go-version: '1.20.5'
- run: |
sudo apt-get install -y sqlite3
npm install
npm run build
nix-build ledger.nix
cp ./result/bin/ledger internal/binary/ledger
go build
cp paisa paisa-cli-linux-amd64
- name: Release
uses: softprops/action-gh-release@v1
with:
draft: true
files: |
paisa-*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
43 changes: 43 additions & 0 deletions .github/workflows/mac.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Mac OS Release

on:
push:
branches:
- ci/mac-*
tags:
- '*'

jobs:
mac-binary:
runs-on: macos-11
steps:
- uses: actions/[email protected]
- uses: actions/setup-node@v3
with:
node-version: 18
cache: npm
- uses: actions/setup-go@v4
with:
go-version: '1.20.5'
- run: |
brew install --force --overwrite sqlite3 create-dmg
brew install --build-from-source --verbose ./ledger.rb
cp "$(brew --prefix ledger)/bin/ledger" internal/binary/ledger
npm install
npm run build
go build
cp paisa paisa-cli-macos-amd64
cd desktop
go install github.com/wailsapp/wails/v2/cmd/wails@latest
wails build
create-dmg --volname "Paisa" --window-pos 200 120 --window-size 800 400 --icon-size 100 --icon "Paisa.app" 200 190 --app-drop-link 600 185 --hide-extension "Paisa.app" --volicon build/bin/Paisa.app/Contents/Resources/iconfile.icns "Paisa.dmg" build/bin/Paisa.app
cd ..
cp desktop/Paisa.dmg paisa-app-macos-amd64.dmg
- name: Release
uses: softprops/action-gh-release@v1
with:
draft: true
files: |
paisa-*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
145 changes: 0 additions & 145 deletions .github/workflows/release.yml

This file was deleted.

45 changes: 45 additions & 0 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Windows Release

on:
push:
branches:
- ci/windows-*
tags:
- '*'

jobs:
windows-binary:
runs-on: windows-2019
steps:
- uses: actions/[email protected]
- uses: actions/setup-node@v3
with:
node-version: 18
cache: npm
- uses: actions/setup-go@v4
with:
go-version: '1.20.5'
- run: |
choco install sqlite
choco install wget
choco install nsis
npm install
npm run build
wget https://github.com/FullofQuarks/Windows-Ledger-Binaries/releases/download/v3.3.2/ledger.exe
cp ledger.exe internal/binary/ledger
go build
cp paisa.exe paisa-cli-windows-amd64.exe
$env:PATH += ";C:\Program Files (x86)\NSIS\Bin"
cd desktop
go install github.com/wailsapp/wails/v2/cmd/wails@latest
wails build -tags webkit2_40 -nsis -webview2 embed
cd ..
cp .\desktop\build\bin\paisa-amd64-installer.exe paisa-app-windows-amd64.exe
- name: Release
uses: softprops/action-gh-release@v1
with:
draft: true
files: |
paisa-*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 0 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,5 @@ FROM alpine:3.18
RUN apk --no-cache add ca-certificates ledger
WORKDIR /root/
COPY --from=go /usr/src/paisa/paisa ./
RUN ./paisa init && ./paisa update
ENV PAISA_DISABLE_LOG_FILE=true
EXPOSE 7500
CMD ["./paisa", "serve"]
24 changes: 24 additions & 0 deletions Dockerfile.demo
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
FROM node:18-alpine3.18 as web
WORKDIR /usr/src/paisa
COPY package.json package-lock.json* ./
RUN npm install
COPY . .
RUN npm run build

FROM golang:1.20-alpine3.18 as go
WORKDIR /usr/src/paisa
RUN apk --no-cache add sqlite gcc g++
COPY go.mod go.sum ./
RUN go mod download && go mod verify
COPY . .
COPY --from=web /usr/src/paisa/web/static ./web/static
RUN CGO_ENABLED=1 go build

FROM alpine:3.18
RUN apk --no-cache add ca-certificates ledger
WORKDIR /root/
COPY --from=go /usr/src/paisa/paisa ./
RUN ./paisa init && ./paisa update
ENV PAISA_DISABLE_LOG_FILE=true
EXPOSE 7500
CMD ["./paisa", "serve"]
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@ windows:


deploy:
docker build -t paisa .
fly scale count 2 --region lax --yes
docker build -t paisa . --file Dockerfile.demo
fly deploy -i paisa:latest --local-only
fly scale count 1 --region lax --yes

install:
npm run build
Expand Down

0 comments on commit c012772

Please sign in to comment.