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
20 changes: 20 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Dependency dirs
node_modules
npm-debug.log
yarn.lock

# Build artifacts
dist
coverage
*.log

# Git and configs
.git
.gitignore
.dockerignore

# Env and secrets
.env
*.pem
*.key

36 changes: 36 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#BASE IMAGE

FROM node:18-alpine

#WORKDIR

WORKDIR /app

#COPY

#COPY DEPENDENCIES FIRST
COPY package*.json ./

#ClEAN INSTALL DEPENDENCIES
RUN npm install

#COPY WHAT IS NEEDED (MUST HAVE FOLDERS)
COPY src ./src
COPY scripts ./scripts

#NON-ROOT USER
RUN addgroup -S appgroup && adduser -S appuser -G appgroup \
&& chown -R appuser:appgroup /app
USER appuser

#BUILD
RUN npm run build


#EXPOSE
EXPOSE 3000

#CMD
CMD ["node", "scripts/start.js"]


32 changes: 32 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,38 @@

[Creative](https://startbootstrap.com/theme/creative/) is a one page, creative website theme built with [Bootstrap](https://getbootstrap.com/) created by [Start Bootstrap](https://startbootstrap.com/).


# StartBootstrap Creative - Dockerized Version

This project is a Dockerized version of the StartBootstrap Creative template. Now you can run it anywhere using Docker or Docker Compose without manual setup.

## Features
- Fully containerized single-stage build (multi-stage optional).
- Non-root user for secure builds.
- Build and serve handled inside Docker.
- Easy deployment using Docker Compose.

## Prerequisites
- Docker >= 20.x
- Docker Compose (optional for local dev)

<img width="1469" height="225" alt="Screenshot 2025-08-17 142714" src="https://github.com/user-attachments/assets/7795d7d7-537d-41fb-a98f-dbc6f1965f76" />

<img width="1811" height="862" alt="Screenshot 2025-08-17 142732" src="https://github.com/user-attachments/assets/5f31e8df-359b-4430-97c4-fc2d005e2c54" />

<img width="1902" height="276" alt="Screenshot 2025-08-17 143716" src="https://github.com/user-attachments/assets/da2d4ad8-05b1-4173-aa46-cafb1d977041" />
<img width="1517" height="266" alt="Screenshot 2025-08-17 143733" src="https://github.com/user-attachments/assets/f589cc4e-ef87-4d4a-ad85-382ef7c643ea" />



## How to Run
### Using Docker
```bash
docker build -t my-app:latest .
docker run -d -p 8080:8080 my-app:latest



## Preview

[![Creative Preview](https://assets.startbootstrap.com/img/screenshots/themes/creative.png)](https://startbootstrap.github.io/startbootstrap-creative/)
Expand Down
9 changes: 9 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
services:
myapp2:
build:
context: .
dockerfile: multi-Dockerfile
container_name: myapp2
restart: always
ports:
- "8080:80"
30 changes: 30 additions & 0 deletions multi-Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Stage 1: Build
FROM node:18-alpine AS builder

# Set working directory
WORKDIR /app

# Copy package.json and package-lock.json
COPY package*.json ./

# Install dependencies
RUN npm ci

# Copy source code
COPY . .

# Build app
RUN npm run build

# Stage 2: Serve with nginx
FROM nginx:alpine

# Copy build output from builder
COPY --from=builder /app/dist /usr/share/nginx/html

# Expose port 80
EXPOSE 80

# Start nginx
CMD ["nginx", "-g", "daemon off;"]