Skip to content

Commit 26a4b41

Browse files
committed
ci: kubernetes deploy
1 parent 40f9ba1 commit 26a4b41

2 files changed

Lines changed: 77 additions & 0 deletions

File tree

.github/workflows/deploy-prod.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Deploy to production
2+
3+
on:
4+
push:
5+
branches: [ "master" ]
6+
7+
env:
8+
REGISTRY: ghcr.io
9+
IMAGE_NAME: ${{ github.repository }}
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
concurrency:
15+
group: ${{ github.workflow }}-${{ github.ref }}
16+
cancel-in-progress: true
17+
18+
steps:
19+
- name: Checkout repository
20+
uses: actions/checkout@v3
21+
22+
- name: Setup Docker buildx
23+
uses: docker/setup-buildx-action@v2.4.1
24+
25+
# Login against a Docker registry
26+
- name: Log into registry ${{ env.REGISTRY }}
27+
uses: docker/login-action@v2.1.0
28+
with:
29+
registry: ${{ env.REGISTRY }}
30+
username: ${{ github.actor }}
31+
password: ${{ secrets.GITHUB_TOKEN }}
32+
33+
# Extract metadata (tags, labels) for Docker
34+
- name: Extract Docker metadata
35+
id: meta
36+
uses: docker/metadata-action@v4.3.0
37+
with:
38+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
39+
40+
# Build and push Docker image with Buildx
41+
- name: Build and push Docker image
42+
id: build-and-push
43+
uses: docker/build-push-action@v4.0.0
44+
with:
45+
file: ./Dockerfile
46+
tags: ${{ steps.meta.outputs.tags }}
47+
labels: ${{ steps.meta.outputs.labels }}
48+
49+
- name: Install kubectl
50+
run: |
51+
wget "https://dl.k8s.io/release/$(wget -qO- https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl"
52+
chmod +x kubectl
53+
mv kubectl /usr/local/bin

Dockerfile

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
FROM nginx:1.23
2+
3+
# Setup mkdocs
4+
RUN apt-get update
5+
RUN apt-get install -y git
6+
RUN apt-get install -y mkdocs
7+
RUN apt-get install -y python3-pip
8+
RUN pip3 install mkdocs-material
9+
RUN pip3 install mkdocs-awesome-pages-plugin
10+
RUN pip3 install fancyboxmd
11+
RUN pip3 install mkdocs-macros-plugin
12+
RUN pip3 install mkdocs-git-revision-date-localized-plugin
13+
14+
# Copy documentation
15+
RUN git clone https://github.com/sourceplusplus/documentation /src
16+
17+
# Build documentation
18+
RUN cd /src && mkdocs build
19+
20+
# Serve documentation
21+
RUN mv /src/site/* /usr/share/nginx/html
22+
23+
# Expose port 80
24+
EXPOSE 80

0 commit comments

Comments
 (0)