Custom Dev-ops Template Setup

How to create deployable dev-ops templates

Custom dev-ops templates allow you to provide pre-configured development environments for your students. This guide explains the required structure and CI/CD setup.

Required Files

Every template must include these files for deployment to work:

File Purpose
Dockerfile Defines how to build the container image
.github/workflows/docker-ci.yml CI/CD pipeline that builds and pushes the Docker image

Workflow Examples

The CI/CD workflow runs on every push and builds your Docker image. Here are examples for different template types:

PHP / Laravel

Save this as .github/workflows/docker-ci.yml:

name: Docker Image CI

on:
  push:
    branches: [ "main" ]

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v3

    - name: Build the Docker image
      run: docker build . --file Dockerfile --tag git.local.skill17.com/${{ github.repository }}

    - name: Docker login
      env:
        USER: ${{ secrets.USER }}
        PASS: ${{ secrets.PASS }}
      run: docker login -u $USER -p $PASS git.local.skill17.com

    - name: Push to registry
      run: docker push git.local.skill17.com/${{ github.repository }}

Node.js / React / Vue

name: Docker Image CI

on:
  push:
    branches: [ "main" ]

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v3

    - name: Build the Docker image
      run: docker build . --file Dockerfile --tag git.local.skill17.com/${{ github.repository }}

    - name: Docker login
      env:
        USER: ${{ secrets.USER }}
        PASS: ${{ secrets.PASS }}
      run: docker login -u $USER -p $PASS git.local.skill17.com

    - name: Push to registry
      run: docker push git.local.skill17.com/${{ github.repository }}
The USER and PASS secrets are automatically configured by NStrim when the template is imported.

Dockerfile Examples

Laravel with Apache

FROM php:8.4-apache

# Install dependencies
RUN apt-get update -y && apt-get install -y \
    openssl zip unzip zlib1g-dev libpq-dev libicu-dev \
    libzip-dev curl libpng-dev git \
    && curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin/ --filename=composer \
    && docker-php-ext-install pdo pdo_pgsql pdo_mysql zip gd \
    && curl -fsSL https://deb.nodesource.com/setup_22.x | bash - \
    && apt-get install -y nodejs \
    && apt-get clean && rm -rf /var/lib/apt/lists/*

# Configure Apache
COPY httpd-vhosts.conf /etc/apache2/sites-available/000-default.conf
RUN a2enmod rewrite

WORKDIR /var/www/html/

# Install PHP dependencies
COPY composer.json composer.lock* ./
RUN composer install --no-dev --optimize-autoloader --no-interaction

# Install Node dependencies and build
COPY package.json package-lock.json* ./
RUN npm ci && npm run build

# Copy application
COPY . .
RUN chown -R www-data:www-data /var/www/html

ENTRYPOINT ["/usr/sbin/apache2ctl", "-D", "FOREGROUND"]

Node.js / React

FROM node:22-alpine

WORKDIR /app

# Install dependencies
COPY package*.json ./
RUN npm ci

# Copy source and build
COPY . .
RUN npm run build

# Serve with a simple static server or run dev server
CMD ["npm", "start"]

Express.js API

FROM node:22-alpine

WORKDIR /app

COPY package*.json ./
RUN npm ci --only=production

COPY . .

EXPOSE 3000
CMD ["node", "server.js"]

Directory Structure

A typical template structure looks like this:

my-template/
├── .github/
│   └── workflows/
│       └── docker-ci.yml    # Required: CI/CD pipeline
├── Dockerfile               # Required: Container build instructions
├── package.json             # For Node.js projects
├── composer.json            # For PHP projects
├── README.md                # Documentation for students
└── src/                     # Your application code
    └── ...
Tip: Test your Dockerfile locally with docker build . before uploading to ensure it builds correctly.

Adding to NStrim

Once your template is ready:

  1. Go to Session → Dev-ops Templates
  2. Click Add New Template
  3. Enter a Git repository URL or upload a ZIP file
  4. Fill in the name, template slug, and description
  5. Click Add Template

NStrim will import the template and configure the necessary secrets for the CI/CD pipeline.

ZIP File Upload

Instead of a Git URL, you can upload a ZIP file containing your template. The ZIP should include the same required files (Dockerfile and .github/workflows/docker-ci.yml). NStrim will validate the ZIP contents on upload.

Custom templates are account-wide — once added, they're available across all sessions in your organization. You can enable or disable them per session from the Dev-ops Templates page.