From 83308564efd388c84c0861f9ff5bd768a5008dc5 Mon Sep 17 00:00:00 2001 From: itepechi <72330683+itepechi@users.noreply.github.com> Date: Tue, 1 Aug 2023 23:41:41 +0900 Subject: [PATCH] Add a Makefile for easy building --- .dockerignore | 13 +++++++++++++ .gitignore | 3 ++- Dockerfile | 22 ++++++++++++++++++++++ Makefile | 29 +++++++++++++++++++++++++++++ README.md | 13 ++++++++++++- 5 files changed, 78 insertions(+), 2 deletions(-) create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100644 Makefile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..3c888ae4 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,13 @@ +.DS_Store +node_modules/ +dist/ +npm-debug.log +test/unit/coverage +test/e2e/reports +selenium-debug.log +.idea/ +config/local.json +config/local.*.json +docs/site/ +.vscode/ +akkoma-fe.zip diff --git a/.gitignore b/.gitignore index a0be5c16..3c888ae4 100644 --- a/.gitignore +++ b/.gitignore @@ -9,4 +9,5 @@ selenium-debug.log config/local.json config/local.*.json docs/site/ -.vscode/ \ No newline at end of file +.vscode/ +akkoma-fe.zip diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..d50ad5bc --- /dev/null +++ b/Dockerfile @@ -0,0 +1,22 @@ +FROM node:20.5.0-alpine3.18 + +RUN apk add --no-cache \ + git \ + chromium-chromedriver + +# use chromedriver from apk +ENV CHROMEDRIVER_FILEPATH=/usr/bin/chromedriver + +WORKDIR /app/ + +COPY ./package.json /app/package.json +COPY ./yarn.lock /app/yarn.lock + +RUN yarn \ + && yarn cache clean + +COPY . /app/ + +ENV NODE_ENV=production + +ENTRYPOINT [ "yarn", "run" ] diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..750fa87d --- /dev/null +++ b/Makefile @@ -0,0 +1,29 @@ +RUNTIME ?= docker +BUILD_DIR ?= ./dist/ +OUTFILE_ZIP ?= ./akkoma-fe.zip + +.PHONY: all +all: build-docker build-fe package + +.PHONY: build-docker +build-docker: + $(RUNTIME) build -t akkoma-fe-builder . + +.PHONY: build-fe +build-fe: +ifeq ("$(wildcard $(BUILD_DIR))","") + mkdir $(BUILD_DIR) +else + rm -rf $(BUILD_DIR) + mkdir $(BUILD_DIR) +endif + $(RUNTIME) run -v ${PWD}/dist/:/app/dist/:Z akkoma-fe-builder build + +.PHONY: package +package: +ifneq ("$(wildcard $(OUTFILE_ZIP))","") + rm $(OUTFILE_ZIP) +endif + zip -r $(OUTFILE_ZIP) $(BUILD_DIR) + +# vim:set noexpandtab: diff --git a/README.md b/README.md index 8a614750..a0ddf97a 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,23 @@ ## What is this? -This is a fork of [AkkomaGang/akkoma-fe](https://akkoma.dev/AkkomaGang/akkoma-fe/), with a custom theme. +This is a fork of [AkkomaGang/akkoma-fe](https://akkoma.dev/AkkomaGang/akkoma-fe/), with a custom theme and Makefile. The differences from the upstream repository are described below: +- Added a Makefile where you can build the client inside a Docker container - Added and changed the default theme to a custom one - Removed some themes to save network bandwidth +### How to build + +```sh +# Docker +make + +# Podman +make RUNTIME=podman +``` + ## Akkoma-FE ![English OK](https://img.shields.io/badge/English-OK-blueviolet?style=for-the-badge) ![日本語OK](https://img.shields.io/badge/%E6%97%A5%E6%9C%AC%E8%AA%9E-OK-blueviolet?style=for-the-badge)