diff --git a/Dockerfile b/Dockerfile index 5bd7efb..d9bfe85 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ ARG ARCH=amd64 -ARG NODE_VERSION=16 +ARG NODE_VERSION=18 ARG OS=bullseye-slim ARG ICONIFY_API_VERSION=3.0.0 ARG SRC_PATH=./ @@ -66,13 +66,13 @@ ARG TAG_SUFFIX=default LABEL org.label-schema.build-date=${BUILD_DATE} \ org.label-schema.docker.dockerfile="Dockerfile" \ org.label-schema.license="MIT" \ - org.label-schema.name="Iconify API.js" \ + org.label-schema.name="Iconify API" \ org.label-schema.version=${BUILD_VERSION} \ org.label-schema.description="Node.js version of api.iconify.design" \ - org.label-schema.url="https://github.com/iconify/api.js" \ + org.label-schema.url="https://github.com/iconify/api" \ org.label-schema.vcs-ref=${BUILD_REF} \ org.label-schema.vcs-type="Git" \ - org.label-schema.vcs-url="https://github.com/iconify/api.js" \ + org.label-schema.vcs-url="https://github.com/iconify/api" \ org.label-schema.arch=${ARCH} \ authors="Vjacheslav Trushkin" diff --git a/README.md b/README.md index d92cfcd..9b9b1a2 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,8 @@ To build a Docker image, run `./docker.sh`. If you want to customise config, fork this repo, customise source code, then build Docker image and deploy API. +To run a Docker image, run `docker run -d -p 3000:3000 iconify/api` (change first 3000 to port you want to run API on). + ## How to use it First, you need to install NPM dependencies and run build script: @@ -71,7 +73,7 @@ Options that can be changed with environment variables and their default values ### Memory management By default, API will use memory management functions. It stores only recently used icons in memory, reducing memory usage. - +000 If your API gets a lot of traffic (above 1k requests per minute), it is better to not use memory management. With such high number of queries, disc read/write operations might cause degraded performance. API can easily handle 10 times more traffic on a basic VPS if everything is in memory and can be accessed instantly. See [memory management in full API docs](https://docs.iconify.design/api/hosting-js/config.html). diff --git a/docker.sh b/docker.sh index 98d8eb5..d997fe2 100755 --- a/docker.sh +++ b/docker.sh @@ -5,8 +5,8 @@ #./docker.sh arm64v8 # To test the docker image a command like this can be used: -#docker run --rm -p 3123:3000 --name iconify-api -v $(realpath "../iconify-cache"):/data/iconify-api/cache -v $(realpath "../iconify-config"):/data/iconify-api/src/config iconify/iconify-api:latest -#docker run --rm -p 3123:3000 --name iconify-api -v /absolute/path/iconify-cache:/data/iconify-api/cache -v /absolute/path/iconify-config:/data/iconify-api/src/config iconify/iconify-api:latest +#docker run --rm -p 3123:3000 --name iconify-api -v $(realpath "../iconify-cache"):/data/iconify-api/cache -v $(realpath "../iconify-config"):/data/iconify-api/src/config iconify/api:latest +#docker run --rm -p 3123:3000 --name iconify-api -v /absolute/path/iconify-cache:/data/iconify-api/cache -v /absolute/path/iconify-config:/data/iconify-api/src/config iconify/api:latest ICONIFY_API_REPO=$(realpath "./") BUILD_SOURCE=$(realpath "./") SHARED_DIR=$BUILD_SOURCE/../shared @@ -24,7 +24,7 @@ echo "Build BASE dir: $BUILD_SOURCE" export ICONIFY_API_VERSION=$(grep -oE "\"version\": \"([0-9]+.[0-9]+.[a-z0-9.-]+)" $ICONIFY_API_REPO/package.json | cut -d\" -f4) -echo "iconify-api.js version: ${ICONIFY_API_VERSION}" +echo "Iconify API version: ${ICONIFY_API_VERSION}" mkdir -p $BUILD_SOURCE/tmp @@ -53,6 +53,6 @@ time docker build --rm=false \ --build-arg TAG_SUFFIX=default \ --build-arg SRC_PATH="$SRC_PATH" \ --file $DOCKERFILE \ - --tag iconify/iconify-api:latest --tag iconify/iconify-api:${ICONIFY_API_VERSION} $BUILD_SOURCE + --tag iconify/api:latest --tag iconify/api:${ICONIFY_API_VERSION} $BUILD_SOURCE rm -fR $BUILD_SOURCE/tmp