Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelkrieger committed Jan 11, 2021
0 parents commit 6355514
Show file tree
Hide file tree
Showing 11 changed files with 828 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/dist-*.zip
/dist
/custom.scss
!/custom.scss.sample
34 changes: 34 additions & 0 deletions BS-BUILD.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Create a container from bootstrapdev if not exist
if [ ! "$(docker ps -q -f name=bsdev)" ]; then
if [ "$(docker ps -aq -f status=exited -f name=bsdev)" ]; then
# cleanup exited container
docker rm bsdev
fi
# Start a new container and run bash
docker create -ti --name bsdev bootstrapdev bash
fi

# Start the container
docker start bsdev

# Update customizations and recompile changes
docker cp ./bootstrap.scss bsdev:/home/bootstrap/bootstrap/scss/bootstrap.scss
docker cp ./custom.scss bsdev:/home/bootstrap/bootstrap/scss/custom.scss
docker exec -ti -w /home/bootstrap/bootstrap/bootstrap bsdev bash -c "git pull --no-rebase"
docker exec -ti -w /home/bootstrap/bootstrap bsdev bash -c "npm run dist"

# Export Files to Host
rm -Rf ./dist
mkdir ./dist
docker cp bsdev:/home/bootstrap/bootstrap/dist/css ./dist/css
docker cp bsdev:/home/bootstrap/bootstrap/dist/js ./dist/js
cd dist
DATESTAMP=`date "+%Y-%m-%d.%H:%M:%S"`
zip -r dist-$DATESTAMP.zip css js
mv dist-$DATESTAMP.zip ..
cd ..

# Delete container
docker rm -f bsdev


23 changes: 23 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM debian:bullseye-slim

# Set the locale
# Download NODE and GIT
RUN apt-get clean && apt-get -y update && \
apt-get install -y locales curl && locale-gen en_CA.UTF-8 && \
curl -sL https://deb.nodesource.com/setup_15.x | bash - && \
apt-get install -y nodejs && \
apt-get install -y vim git && \
apt-get clean

# Create a build folder and copy our files
WORKDIR /home/bootstrap/bootstrap
COPY ["package.json", "/home/bootstrap/bootstrap/"]
COPY ["bootstrap.scss", "custom.scss", "/home/bootstrap/bootstrap/scss/"]

# Get Bootstrap from GitHub
# Install the required loaders and postcss plugins for compiling and bundling Bootstrap precompiled Sass files.
# Install all dependencies
RUN npm run get && npm install autoprefixer css-loader node-sass postcss-loader sass-loader style-loader exports-loader && npm run setup

# A sane starting environment for subsequent scripts
WORKDIR /home/bootstrap
3 changes: 3 additions & 0 deletions IMAGE-BUILD.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

docker build -t bootstrapdev .
3 changes: 3 additions & 0 deletions IMAGE-DELETE.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

docker rmi bootstrapdev
11 changes: 11 additions & 0 deletions IMAGE-RUN.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
if [ ! "$(docker ps -q -f name=bsdev)" ]; then
if [ "$(docker ps -aq -f status=exited -f name=bsdev)" ]; then
# cleanup exited container
docker rm bsdev
fi
# Start a new container and run bash
docker run -it --name bsdev --entrypoint bash bootstrapdev
else
# Run bash within existing container
docker exec -it --name bsdev bash
fi
674 changes: 674 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# bootstrap-docker

This set of scripts can be used to easily compile a customized version of Bootstrap, handling all dependencies and tools.

## TL;DR Instructions
- First Run (Skip this on subsequent runs)
- Clone this GIT with `git clone https://github.com/michaelkrieger/bootstrap-docker.git`
- Enter the repository with `cd bootstrap-docker`
- Run `./IMAGE-BUILD.sh` to build the Docker image
- Rename *custom.scss.sample* to *custom.scss* and incorporate your changes
- Run `./BS-BUILD.sh` to import your custom.scss and output a *dist* folder and a zip file.

## Commands
#### ./IMAGE-BUILD.sh
Builds a docker image from the Dockerfile. The Dockerfile installs all necessary tools (and vim) needed to compile Bootstrap from its source, as well as does an initial clone from GitHub. All dependencies are also pulled.

#### ./BS-BUILD.sh
Updates Bootstrap from GitHub, Imports your bootstrap.scss file from the current folder, Recompiles Bootstrap CSS and JS, and Outputs a dist folder and zip file of the compiled source. The instance is deleted after it is executed.

#### ./IMAGE-DELETE.sh
Frees the disk space used by the image created with ./IMAGE-BUILD.sh

#### ./IMAGE-RUN.sh
Provides a shell within the Docker Image which can be used to debug any error messages
22 changes: 22 additions & 0 deletions bootstrap.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

// Import our custom changes
@import "./custom.scss";


// Bootstrap Option A: Include all of Bootstrap
@import "../bootstrap/scss/bootstrap";


// Bootstrap Option B: Include parts of Bootstrap
// Required
//@import "../bootstrap/scss/functions";
//@import "../bootstrap/scss/variables";
//@import "../bootstrap/scss/mixins";

// Optional
//@import "../bootstrap/scss/root";
//@import "../bootstrap/scss/reboot";
//@import "../bootstrap/scss/type";
//@import "../bootstrap/scss/images";
//@import "../bootstrap/scss/containers";
//@import "../bootstrap/scss/grid";
6 changes: 6 additions & 0 deletions custom.scss.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
$body-bg: #ffffff; // White
$body-color: #000000; // Black
$primary: #980000;
$secondary: #ff9900;
$link-color: #980000;
$link-hover-color: #ff9900;
24 changes: 24 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "bootstrap",
"description": "The most popular front-end framework for developing responsive, mobile first projects on the web.",
"scripts": {
"get": "test -e bootstrap || git clone https://github.com/twbs/bootstrap",
"update": "test -e bootstrap && cd ./bootstrap && git pull",
"setup": "npm install && cd ./bootstrap && npm install",

"build-css": "node-sass ./scss/bootstrap.scss -o ./bootstrap/dist/css/ && npm run bootstrap-scripts",
"bootstrap-scripts": "cd ./bootstrap && npm-run-all css-prefix css-rtl css-minify",

"build-js": "cd ./bootstrap && npm-run-all js",

"copy-dist-css": "mkdir -p dist/css && cp ./bootstrap/dist/css/* ./dist/css",
"copy-dist-js": "mkdir -p dist/js && cp ./bootstrap/dist/js/* ./dist/js",
"copy-dist": "npm-run-all copy-dist-css copy-dist-js",

"dist": "npm-run-all build-css build-js copy-dist",
"complete": "npm run get && npm run setup && npm run dist"
},
"dependencies": {
"npm-run-all": "^4.1.5"
}
}

0 comments on commit 6355514

Please sign in to comment.