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

Dockerized build and build instructions update #36

Merged
merged 1 commit into from
May 7, 2020
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
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
frontend/node_modules/
app/dcrwalletgui
build/
43 changes: 43 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Stage I - frontend node build
FROM debian:stretch-slim AS nodebuilder

RUN apt-get update && apt-get install -y -q --no-install-recommends \
ca-certificates \
curl \
git

SHELL ["/bin/bash", "--login", "-c"]

RUN curl -sL https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash
RUN nvm install v11 && nvm use v11
RUN npm install --global yarn

WORKDIR /root

COPY . .

WORKDIR frontend/
RUN yarn && yarn build

# stage II - Go build & packaging
FROM golang:1.13-stretch

RUN apt-get update && apt-get install -y -q --no-install-recommends \
libwebkit2gtk-4.0-dev \
libgtk-3-dev \
libcairo2-dev \
libglib2.0-dev \
libappindicator3-dev \
libappindicator3-0.1-cil-dev

RUN go get -v github.com/markbates/pkger/cmd/pkger

WORKDIR /root
COPY --from=nodebuilder /root/deps ./deps
COPY --from=nodebuilder /root/app ./app
COPY --from=nodebuilder /root/frontend/dist/ ./app/www/
COPY --from=nodebuilder /root/build-linux.sh .

ENV NO_FRONTEND_BUILD yes
RUN ./build-linux.sh

21 changes: 20 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,31 @@ By default, `dcrwallet` listens on port 9111 (mainnet) or 19111 (testnet). The

### Linux (Debian, Ubuntu)

##### Dependencies:

* `yarn`
* `golang` 1.12 or later (tested on 1.13 but should work on 1.12)
* development packages:
```
apt-get install libwebkit2gtk-4.0-dev \
libgtk-3-dev \
libcairo2-dev \
libglib2.0-dev \
libappindicator3-dev \
libappindicator3-0.1-cil-dev
```

`./build-linux.sh`

There is an experimental `Dockerfile` to build without having to install dependencies:

`docker build -t decred/dcrwalletgui .`

### MacOS

`./build-macos.sh`


### Windows

TODO - [contribution welcome](https://github.com/peterzen/kohola/issues/8)
Expand All @@ -32,7 +51,7 @@ TODO - [contribution welcome](https://github.com/peterzen/kohola/issues/8)

1. Clone repo

`git clone --recurse-submodules https://github.com/peterzen/kohola`
`git clone https://github.com/peterzen/kohola`

2. Build and run React frontend

Expand Down
9 changes: 7 additions & 2 deletions build-linux.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
#!/bin/sh

set -e

APP=kohola
APPDIR=build/${APP}

mkdir -p $APPDIR
mkdir -p $APPDIR/usr/bin
mkdir -p $APPDIR/usr/share/applications
mkdir -p $APPDIR/usr/share/icons/hicolor/1024x1024/apps
mkdir -p $APPDIR/usr/share/icons/hicolor/256x256/apps
mkdir -p $APPDIR/DEBIAN

cd frontend && yarn install && yarn build && cd ..
cp -R frontend/dist app/www
if [ "$NO_FRONTEND_BUILD" = "" ]; then
cd frontend && yarn install && yarn build && cd ..
cp -R frontend/dist app/www
fi
cd app
pkger -include /www
go build -o ../$APPDIR/usr/bin/$APP
Expand Down
10 changes: 8 additions & 2 deletions build-macos.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
#!/bin/sh

set -e

APP="build/Kohola.app"
mkdir -p $APP/Contents/{MacOS,Resources}
cp app/icons/icon.icns $APP/Contents/Resources/icon.icns
cd frontend && yarn install && yarn build && cd ..
cp -R frontend/dist app/www

if [ "$NO_FRONTEND_BUILD" = "" ]; then
cd frontend && yarn install && yarn build && cd ..
cp -R frontend/dist app/www
fi

cd app
pkger -include /www
go build -o ../$APP/Contents/MacOS/kohola
Expand Down