diff --git a/.gitea/workflows/pipeline-build.yaml b/.gitea/workflows/pipeline-build.yaml new file mode 100644 index 0000000..32b4458 --- /dev/null +++ b/.gitea/workflows/pipeline-build.yaml @@ -0,0 +1,9 @@ +name: Build Pipeline for de.captica.n8n +run-name: ${{ gitea.actor }} pushed new changes to ${{ gitea.branch }} + +on: [push] + +jobs: + Publish Docker: + uses: captica-oss/de.captica.expert.devops/.gitea/workflows/publish-docker.yaml@main + secrets: inherit \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..ea19bb8 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,26 @@ +FROM node:22-slim + + + +# Update everything and install needed dependencies +RUN apt-get update -y && \ + apt-get upgrade -y && \ + apt-get install -y -q graphicsmagick tzdata build-dependencies python build-base ca-certificates && \ + useradd -r -U -d /opt/captica/${NAME_APPLICATION} -c "captica Service User" -m captica + +# # Set a custom user to not have n8n run as root +USER captica + +# Install n8n and the also temporary all the packages +# it needs to build it correctly. +RUN N8N_VERSION=$(curl -s https://api.github.com/repos/n8n-io/n8n/releases/latest | jq -r '.tag_name' | sed 's/^v//') && \ + echo "Latest n8n version: ${N8N_VERSION}" && \ + npm_config_user=root npm install -g {N8N_VERSION} && \ + apt-get remove build-dependencies build-base && \ + apt-get autoremove -y && \ + apt-get autoclean -y + + +WORKDIR /data + +CMD ["n8n"] \ No newline at end of file diff --git a/README.md b/README.md index bae44a8..f98c92e 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,46 @@ # de.captica.n8n -Customize n8n installation \ No newline at end of file +This project contains a Dockerfile to build a Docker image for [n8n](https://n8n.io/), a free and open-source node-based workflow automation tool. + +The original image of n8n is based on an alpine image which has some unusable tools + +## Table of Contents + +- [Prerequisites](#prerequisites) +- [Building the Docker Image](#building-the-docker-image) +- [Running the Docker Container](#running-the-docker-container) +- [Customizing the Docker Image](#customizing-the-docker-image) +- [License](#license) + +## Prerequisites + +- Docker installed on your system +- Access to a Docker registry (optional) + +## Building the Docker Image + +To build the Docker image, navigate to the project directory and run the following command: + +```bash +docker build -t de.captica.n8n . +``` +This will build the Docker image using the Dockerfile in the current directory. + +## Running the Docker Container + +### To run the Docker container, use the following command + +```bash +docker run -d -p 5678:5678 --name n8n de.captica.n8n +``` + +This will start a detached Docker container named "n8n" and expose port 5678 on your host machine. You can access n8n at http://localhost:5678 in your browser. + +### Customizing the Docker Image +To customize the Docker image, you can modify the Dockerfile and rebuild the image. Here are some examples of customizations you might consider: +1. Add custom workflows: Copy your workflows into the /data directory in the Dockerfile. +2. Set environment variables: Use the ENV directive in the Dockerfile to set environment variables for n8n. +3. Install additional packages: Use the RUN directive to install additional packages using apt-get or npm. + +## License +This project is licensed under the MIT License. See the LICENSE file for more information.