Skip to content
Open
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
10 changes: 10 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
node_modules
dist
.git
.gitignore
Dockerfile
docker-compose.yml
npm-debug.log
coverage
test
scripts
36 changes: 36 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,39 @@
## Docker Support

This project includes Docker support, allowing you to run the application in a containerized environment. Below are the steps to build and use the Docker image:

### Building the Docker Image
To build the Docker image, run the following command in the root directory of the project:
```bash
Command 1: docker build -t template-engine .
Note: You can replace "template-engine" with the name you want to give to the Docker image

Running the Docker Container
Once the image is built, you can run the container using:
Command 2: docker run -p 3000:3000 template-engine

The -p 3000:3000 flag maps port 3000 of the container to port 3000 on your local machine.
If the application uses a different port, update the -p flag accordingly.

Environment Variables
If the application requires environment variables (e.g., database credentials, API keys, etc.), you can pass them using a .env file. Create a .env file in the root directory with the required variables in the following format:

KEY=value

Then, run the container with:
Command 4: docker run --env-file .env -p 3000:3000 template-engine

Accessing the Application
http://localhost:3000

To stop the running container, use:
Command 5: docker stop <container-id>

Replace <container-id> with the ID or name of the running container, which you can find using: docker ps

Happy Coding...


# Template Engine

This is the [Accord Project](https://accordproject.org) template engine. Rich-text templates are defined in TemplateMark (either as markdown files, or JSON documents) and are then merged with JSON data to produce output documents. Templates may contain [TypeScript](https://www.typescriptlang.org) expressions.
Expand Down
23 changes: 23 additions & 0 deletions dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Base image (Using lightweight Alpine variant for optimization)
FROM node:18-alpine

# Set working directory
WORKDIR /app

# Copy package.json and package-lock.json first (for efficient caching)
COPY package.json package-lock.json ./

# Install dependencies
RUN npm install

# Copy the entire project (excluding files in .dockerignore)
COPY . .

# Build the TypeScript project
RUN npm run build

# Expose the port the app runs on (optional, for documentation purposes)
EXPOSE 3000

# Default command (Modify if there's a specific entry point)
CMD ["node", "dist/index.js"]
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
*/

export { TemplateMarkInterpreter } from './TemplateMarkInterpreter';
export * from './utils';
export * from './utils';