Static Site Generator created by Python
- Python >= ver3.6.x
Before installing, you need to setup Python and pip.
FROM ubuntu:18.04
RUN apt-get -y update
RUN apt-get -y install software-properties-common
RUN apt-get -y update
RUN apt-get -y install git docker vim
RUN apt-get -y install nginx
RUN apt-get -y install python3.6-dev
RUN apt-get -y install python3-pip
COPY default.conf /etc/nginx/conf.d/default.conf
docker build -t ubuntu_site_generater .
docker stop ubuntu_site_generater_con
docker rm ubuntu_site_generater_con
docker run -p 8080:80 -v -it --name ubuntu_site_generater_con ubuntu_site_generater:latest /bin/bash
server {
listen 80;
server_name localhost;
server_tokens off;
location / {
root /var/www/simple-site-generator/public;
}
}
Execute run.sh
After you go into container, move to web dir and chekout this project.
cd /var/www
git clone git@github.com:uzura8/simple-site-generator.git
cd simple-site-generator
pip3 install -r requirements.txt
Edit configs for your site by yaml format, after copy from sample.
cp config.yml.sample config.yml
cp content/en.yml.sample content/en.yml
cp content/ja.yml.sample content/ja.yml
vi config.yml content/en.yml content/ja.yml
After execute below command, index.html generated under public dir.
python3 builder.py
nginx
You can access http://localhost:8080/
- Read docs: https://cloud.google.com/storage/docs/hosting-static-website
- You have to do below for preparation
- Domain ownership verification
- Register "c.storage.googleapis.com" to CNAME of your domain
- Create GCP Project
-
Access to Google Search Console( https://search.google.com/search-console )
-
Register TXT your domain of DNS record
-
Register "c.storage.googleapis.com" to CNAME of your domain
-
Refer to https://cloud.google.com/storage/docs/hosting-static-website#cname
-
Refer to GCP docs to create project
-
Make sure that billing is enabled for your Google Cloud project
-
Get gcp credential json file
RUN chsh -s /usr/bin/zsh
FROM ubuntu:18.04
USER root
RUN apt-get -y update
RUN apt-get -y install software-properties-common
RUN yes | add-apt-repository ppa:jonathonf/vim
RUN apt-get -y update
RUN apt-get -y install zsh
RUN chsh -s /usr/bin/zsh
RUN /usr/bin/zsh
RUN apt-get -y install git docker vim neovim
RUN apt-get -y install python3.6-dev
RUN apt-get -y install python3-pip
RUN pip install --upgrade pip
RUN apt-get -y update
RUN apt-get install wget
RUN apt-get -y install zip unzip
RUN apt-get install -y curl
RUN export CLOUD_SDK_REPO="cloud-sdk-$(lsb_release -c -s)" && \
echo "deb http://packages.cloud.google.com/apt $CLOUD_SDK_REPO main" | tee -a /etc/apt/sources.list.d/google-cloud-sdk.list && \
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - && \
apt-get update -y && apt-get install google-cloud-sdk -y
WORKDIR /root
docker build -t ubuntu_sg .
docker stop ubuntu_sg_con
docker rm ubuntu_sg_con
docker run -v /Users/hogehoge/.config/gcloud:/root/.config/gcloud -it --name ubuntu_sg_con ubuntu_sg:latest /bin/bash
Execute run.sh, and move to Docker container
Move to your work dir on Docker container, and chekout this.
# Below on Docker Container
mkdir ~/.ssh
vim ~/.ssh/id_rsa
# Put your key and save
chmod 600 ~/.ssh/id_rsa
cd /path-to-your-work-dir/
git clone git@github.com:************.git your-project-dir-name
cd your-project-dir-name
git checkout this-branch # if need
pip3 install -r requirements.txt
Edit configs for your site by yaml format, after copy from sample.
cp config.yml.sample config.yml
cp content/en.yml.sample content/en.yml
cp content/ja.yml.sample content/ja.yml
vi config.yml content/en.yml content/ja.yml
After execute below command, index.html generated under public dir.
python3 builder.py
bash gcs_upload.sh your-domain.example.com