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

Changed the build for the firefox browser #3733

Merged
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
9 changes: 7 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:16-alpine
FROM node:16-alpine AS build

WORKDIR /tally-ho

Expand All @@ -8,4 +8,9 @@ RUN mv .env.prod .env
RUN apk add --no-cache python3 py3-pip git make bash && ln -sf python3 /usr/bin/python
# sqlite compile throws an error during install, but it does not cause any problem so we are ignoring it
RUN yarn install --frozen-lockfile || true
RUN yarn build --config-name firefox
ENV SUPPORT_BROWSER="firefox"
RUN yarn build

FROM scratch AS dist

COPY --from=build /tally-ho/dist .
40 changes: 29 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -334,17 +334,35 @@ ui/ # @tallyho/tally-ui package

Firefox requires to upload source code if minifier is used and to be able to compile identical output to the uploaded package. Our builds are environment dependent at the moment because of the minification and source map process. Long term solution will be to upgrade our build process to be able to produce identical file assets, but until then we use Docker.

- install and setup docker: https://docs.docker.com/get-docker/
- git clone git@github.com:tallycash/extension.git tallyho-firefox
- cd tallyho-firefox
- git checkout tags/latest_release-tag
- .env.prod: fill in the prod API keys
- `./firefox-build.sh`
- mv firefox.zip ../
- git clean -fdx
- rm -rf .git
- cd ..
- zip -r tallyho-firefox.zip tallyho-firefox
1. Install and setup container manger, like at [nerdctl](https://github.com/containerd/nerdctl),[podman](https://podman.io/) or [docker](https://www.docker.com/)
2. Clone git repository

```sh
git clone https://github.com:tallycash/extension.git tallyho-firefox
```

3. Change the directory

```sh
cd tallyho-firefox
git checkout tags/latest_release-tag
```

4. Fill the production keys `.env.prod` file

5. Run build script

```sh
./firefox-build.sh
```

6. Archive it

```sh
zip -r tallyho-firefox.zip dist/firefox
```

7. You can delete everything if you want except for the archive

## Localization

Expand Down
27 changes: 17 additions & 10 deletions firefox-build.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,24 @@
#!/bin/bash
#!/bin/env sh

if command -v nerdctl &> /dev/null; then
ctrmanager=nerdctl
elif command -v docker &> /dev/null; then
ctrmanager=docker
elif command -v podman &> /dev/null; then
ctrmanager=podman
else
echo "Installing a container manager" >&2
exit
fi

echo "--- Let's clean up from earlier ---"
rm firefox.zip
docker container rm -f tally-ho-container || true
docker image rm --force tally-ho-image:latest || true
rm -rf dist
$ctrmanager image rm --force tally-ho-image:latest || true

echo "--- Build extension ---"
docker build --no-cache -t tally-ho-image:latest .
docker create --name tally-ho-container tally-ho-image

echo "--- Copy build output to host ---"
docker cp tally-ho-container:/tally-ho/dist/firefox.zip ./firefox.zip
$ctrmanager build -t tally-ho-image:latest --output=dist --target=dist .

echo "--- Let's clean up ---"
docker container rm -f tally-ho-container || true
docker image rm --force tally-ho-image:latest || true

$ctrmanager image rm --force tally-ho-image:latest || true
4 changes: 4 additions & 0 deletions webpack.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ import "dotenv-defaults/config"

const supportedBrowsers = ["chrome"]

if (process.env.SUPPORT_BROWSER === "firefox") {
supportedBrowsers.push("firefox")
}

// Replicated and adjusted for each target browser and the current build mode.
const baseConfig: Configuration = {
devtool: "source-map",
Expand Down
Loading