commit aa8462c95193b5e3a5569ad4a354f6c905ea8be2 Author: bain Date: Thu Aug 1 23:06:48 2024 +0200 Initial commit diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..c6f5586 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,9 @@ +[submodule "ticker"] + path = ticker + url = https://github.com/systemli/ticker +[submodule "ticker-admin"] + path = ticker-admin + url = https://github.com/systemli/ticker-admin +[submodule "ticker-frontend"] + path = ticker-frontend + url = https://github.com/systemli/ticker-frontend diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..cce47f2 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,17 @@ +FROM alpine + +RUN apk add nginx libc6-compat gcompat sqlite + +# believe or not, this is what the official image does +RUN ln -sf /dev/stdout /var/log/nginx/access.log && ln -sf /dev/stderr /var/log/nginx/error.log + +COPY ticker-web.conf /etc/nginx/http.d/default.conf + +COPY ticker-admin/dist /var/www/admin +COPY ticker-frontend/dist /var/www/frontend + +COPY ticker/ticker /ticker-bin + +WORKDIR /ticker + +CMD [ "sh", "-c", "nginx; /ticker-bin run --config /config.yml" ] diff --git a/README.md b/README.md new file mode 100644 index 0000000..3cdefb9 --- /dev/null +++ b/README.md @@ -0,0 +1,8 @@ +# Ticker AIO docker image + +Publishes: + - ticker API on 8080 + - frontend for tickers on 8081 + - admin frontend on 8082 + +See `config.yml.sample` and `docker-compose.yml` for a setup example. diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..58c6fb5 --- /dev/null +++ b/build.sh @@ -0,0 +1,25 @@ +#!/bin/env bash +set -e + +if [ -z "$TICKER_API_URL" ]; then + echo "TICKER_API_URL env not set"; + exit 1; +fi + +pushd ticker-admin +yarn +yarn run build +popd + +pushd ticker-frontend +yarn +yarn run build +popd + +pushd ticker +go build -ldflags '-linkmode external -extldflags -static -w' . +popd + +docker build -t ticker-aio . + +echo "successfully build ticker-aio image" diff --git a/config.yml.sample b/config.yml.sample new file mode 100644 index 0000000..664475f --- /dev/null +++ b/config.yml.sample @@ -0,0 +1,11 @@ +# listen binds ticker to specific address and port +listen: "0.0.0.0:8080" +# log_level sets log level for logrus +log_level: "error" +# configuration for the database +database: + type: "sqlite" # postgres, mysql, sqlite + dsn: "ticker.db" # postgres: "host=localhost port=5432 user=ticker dbname=ticker password=ticker sslmode=disable" + +# secret used for JSON Web Tokens +secret: "SECRETTTTTTTTTT" diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..b4ba9d0 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,10 @@ +services: + ticker: + build: . + volumes: + - ./ticker-mount:/ticker + - ./config.yml:/config.yml + ports: + - 8080:8080 + - 8081:8081 + - 8082:8082 diff --git a/ticker b/ticker new file mode 160000 index 0000000..dd0ba87 --- /dev/null +++ b/ticker @@ -0,0 +1 @@ +Subproject commit dd0ba8768f67ae380d2113d6426740ff77fca936 diff --git a/ticker-admin b/ticker-admin new file mode 160000 index 0000000..9b5e60b --- /dev/null +++ b/ticker-admin @@ -0,0 +1 @@ +Subproject commit 9b5e60b5fbb5a2bf2d1866f8f2974057a71ed0e4 diff --git a/ticker-frontend b/ticker-frontend new file mode 160000 index 0000000..f2cb391 --- /dev/null +++ b/ticker-frontend @@ -0,0 +1 @@ +Subproject commit f2cb391b27b8b88398725d322edb68fe1a18a6bd diff --git a/ticker-web.conf b/ticker-web.conf new file mode 100644 index 0000000..2d91d29 --- /dev/null +++ b/ticker-web.conf @@ -0,0 +1,21 @@ +server { + listen 8081 default_server; + server_name _; + + root /var/www/frontend; + + location / { + try_files $uri $uri/ =404; + } +} + +server { + listen 8082 default_server; + server_name _; + + root /var/www/admin; + + location / { + try_files $uri $uri/ =404; + } +}