Skip to content
Merged
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
102 changes: 82 additions & 20 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,53 @@
version: 2.1

executors:
alpine-environment:
build-environment:
docker:
- image: alpine:3.16

deploy-environment:
docker:
- image: node:18.7.0-alpine3.16

publish-environment:
docker:
- image: docker:20.10.17-cli-alpine3.16

jobs:
verify:
executor: alpine-environment
verify-build-environment:
executor: build-environment

steps:
- checkout
- run:
name: "Verify apk"
command: "apk --version"

verify-deploy-environment:
executor: deploy-environment

steps:
- run:
name: "Verify Job"
command: "echo Verify job is working!"
name: "Verify apk"
command: "apk --version"

- run:
name: "Verify Node.js"
command: "node -v"

- run:
name: "Verify npm"
command: "npm -v"

verify-publish-environment:
executor: publish-environment

steps:
- run:
name: "Verify Docker"
command: "docker -v"

build:
executor: alpine-environment
executor: build-environment

steps:
- checkout
Expand All @@ -41,15 +71,20 @@ jobs:
- run:
name: "Building Site"
command: "hugo --gc --minify"

- persist_to_workspace:
root: .

paths:
- ./public

- when:
condition:
equal: [ main, << pipeline.git.branch >>]

steps:
- persist_to_workspace:
root: .

paths:
- ./public

deploy:
executor: alpine-environment
executor: deploy-environment

steps:
- checkout
Expand All @@ -61,10 +96,6 @@ jobs:
name: "Update Alpine Repositories"
command: "apk update"

- run:
name: "Install Git"
command: "apk add git"

- run:
name: "Update npm"
command: "npm install -g npm"
Expand All @@ -76,11 +107,31 @@ jobs:
- run:
name: "Deploy To Netlify"
command: "netlify deploy --site $NETLIFY_SITE_ID --auth $NETLIFY_ACCESS_TOKEN --prod --dir=public"


publish:
executor: publish-environment

steps:
- checkout

- run:
name: "Login Into Docker Hub"
command: "docker login --username $DOCKER_USERNAME --password $DOCKER_ACCESS_TOKEN"

- run:
name: "Build Docker Image"
command: "docker build -f .docker/blog.Dockerfile -t airscript/blog:$CIRCLE_TAG ."

- run:
name: "Publish To Docker Hub"
command: "docker push airscript/blog:$CIRCLE_TAG"

workflows:
verify:
jobs:
- verify
- verify-build-environment
- verify-deploy-environment
- verify-publish-environment

build:
jobs:
Expand All @@ -89,6 +140,7 @@ workflows:
deploy:
jobs:
- build

- deploy:
requires:
- build
Expand All @@ -97,3 +149,13 @@ workflows:
branches:
only:
- main
publish:
jobs:
- publish:
filters:
tags:
only:
- /.*/

branches:
ignore: /.*/
23 changes: 23 additions & 0 deletions .docker/blog.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM node:18.7.0-alpine3.16

LABEL maintainer="Airscript <dev.airscript@gmail.com>"

ENV BLOG_PORT=25001
ENV BLOG_INTERFACE=0.0.0.0

ARG BLOG_DIR=app

RUN apk update
RUN apk add git
RUN apk add hugo

RUN mkdir ${BLOG_DIR}
WORKDIR /${BLOG_DIR}

COPY . .
RUN git submodule update --init --recursive

ENTRYPOINT ["./docker-entrypoint.sh"]
CMD ["hugo"]

EXPOSE ${BLOG_PORT}
26 changes: 24 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,27 @@
[![CircleCI](https://dl.circleci.com/status-badge/img/gh/Airscripts/blog.airscript.it/tree/main.svg?style=svg)](https://dl.circleci.com/status-badge/redirect/gh/Airscripts/blog.airscript.it/tree/main) [![Netlify Status](https://api.netlify.com/api/v1/badges/59826574-7ccb-4c30-a776-942044cf9520/deploy-status?branch=main)](https://app.netlify.com/sites/regal-sunshine-3cc2d8/deploys)

This repository contains source code and content of my blog hosted on [blog.airscript.it](https://blog.airscript.it).
&nbsp;

## 📦 Installation
In order to the use correct version of Hugo it is **recommended** to use Docker.
&nbsp;

### 🐳 Containerized Environment
1. Install Docker and Docker Compose on your machine following these links:
- [Docker](https://docs.docker.com/get-docker/)
- [Docker Compose](https://docs.docker.com/compose/install/)

2. Run the following commands in the repository's root folder:
```bash
docker compose build
docker compose up
```

3. Everything should be set up and running on port 25001.
&nbsp;

### 💻 Local Environment
1. Clone this repository:
```bash
git clone https://github.com/Airscripts/blog.airscript.it.git
Expand All @@ -19,10 +38,12 @@ This repository contains source code and content of my blog hosted on [blog.airs
4. Run the following command:
```bash
hugo server
```
```
&nbsp;

## 🤝 Contributing
Contributions and suggestions about how to improve the blog are welcome!
&nbsp;

## 💚 Support
If you want to support my work you can do it with the links below.
Expand All @@ -31,7 +52,8 @@ Choose what you find more suitable for you:
- [Support me on GitHub](https://github.com/sponsors/Airscripts)
- [Support me via linktr.ee](https://linktr.ee/airscript)

Thank you so much, it means a lot for me!
Thank you so much, it means a lot for me!
&nbsp;

## 💳 License
This repository has dual-licensing.
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0.0
1.1.0
2 changes: 1 addition & 1 deletion config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pygmentsUseClasses = true
enableInlineShortcodes = true
defaultContentLanguage = "it"
baseURL = "https://blog.airscript.it"
copyright = "airscript.it (1.0.0) | Sharing happiness with code."
copyright = "airscript.it (1.1.0) | Sharing happiness with code."


[languages.it]
Expand Down
24 changes: 24 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
version: "3.9"

services:
blog:
tty: true
restart: always
image: airscript/blog:1.1.0
container_name: airscript-blog

ports:
- "25001:25001/udp"
- "25001:25001/tcp"

volumes:
- .:/app

networks:
default:
aliases:
- blognet

build:
context: .
dockerfile: ".docker/blog.Dockerfile"
8 changes: 8 additions & 0 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/sh
set -e

if [ "$1" = 'hugo' ]; then
hugo server --bind $BLOG_INTERFACE --port $BLOG_PORT
fi

exec "$@"