Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Dockerfile #120

Merged
merged 1 commit into from
Oct 18, 2023
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
6 changes: 2 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ jobs:
name: Build
runs-on: ubuntu-20.04
steps:
- name: Use Node.js 14.x
- name: Use Node.js 18.x
uses: actions/setup-node@v1
with:
node-version: '16'
node-version: '18'
check-latest: true

- uses: actions/checkout@v1
Expand Down Expand Up @@ -49,8 +49,6 @@ jobs:
npm install

- name: Build
env:
GOOGLE_CUSTOM_SEARCH_API_KEY: ${{ secrets.GOOGLE_CUSTOM_SEARCH_API_KEY }}
run: make gen-prod

# - name: Check links
Expand Down
88 changes: 88 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: Deploy

on:
workflow_dispatch:
inputs:
cluster:
description: 'Cluster'
required: true
type: choice
options:
- ninja
- prod
version:
description: 'Tag'
# required: true
type: string

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true

jobs:
build:
name: Build
runs-on: f0
steps:
- uses: actions/checkout@v1

- uses: actions/setup-node@v2
with:
node-version: '18'
check-latest: true

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'

- name: Install Linode CLI
run: |
python -m pip install --upgrade pip
pip --version
pip install setuptools
pip install linode-cli --upgrade

- name: Install kubectl
run: |
curl -LO https://dl.k8s.io/release/v1.25.2/bin/linux/amd64/kubectl
chmod +x ./kubectl
sudo mv ./kubectl /usr/local/bin/kubectl

- name: Install yq
run: |
curl -fsSL -o yqq https://github.com/mikefarah/yq/releases/download/3.3.0/yq_linux_amd64
chmod +x yqq
sudo mv yqq /usr/local/bin/yqq
pip3 install yq

- name: Install Hugo
run: |
curl -fsSL -o hugo_extended.deb https://github.com/gohugoio/hugo/releases/download/v0.111.1/hugo_extended_0.111.1_linux-amd64.deb
sudo dpkg -i hugo_extended.deb

- name: Install Hugo Tools
run: |
curl -fsSL -o hugo-tools https://github.com/appscodelabs/hugo-tools/releases/download/v0.2.23/hugo-tools-linux-amd64
chmod +x hugo-tools
sudo mv hugo-tools /usr/local/bin/hugo-tools

# - name: Setup upterm session
# uses: lhotari/action-upterm@v1

- name: Deploy
env:
REGISTRY: ghcr.io/appscode
LINODE_CLI_TOKEN: ${{ secrets.LINODE_CLI_TOKEN }}
CLUSTER: ${{ inputs.cluster }}
run: |
lke_id=19953 # ninja cluster
if [ "$CLUSTER" = "prod" ]; then
lke_id=25516 # prod cluster
fi
echo "connect to LKE cluster $lke_id"
mkdir -p ~/.kube
linode-cli lke kubeconfig-view $lke_id --json | jq -r .[0].kubeconfig | base64 -d > ~/.kube/config
kubectl get nodes
echo "deploy docker image"
make deploy-to-linode TAG=${{ inputs.version }}
4 changes: 2 additions & 2 deletions .github/workflows/preview-website.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ jobs:
- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ^1.20
go-version: ^1.21
id: go

- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: '16'
node-version: '18'
check-latest: true

- name: Install yq
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/release-tracker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ concurrency:

jobs:
build:
runs-on: ubuntu-20.04
name: Build
runs-on: f0
steps:
- uses: actions/checkout@v1

Expand Down
98 changes: 69 additions & 29 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@ name: Release
on:
push:
tags:
- "*.*"
schedule:
- cron: '0 0 * * *'
# Allows you to run this workflow manually from the Actions tab
- '*.*'
workflow_dispatch:

concurrency:
Expand All @@ -16,22 +13,63 @@ concurrency:
jobs:
build:
name: Build
runs-on: ubuntu-20.04
runs-on: f0
steps:
- uses: actions/checkout@v1

- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ^1.20
id: go
- name: Check tag matches package version
run: |
PKG_VERSION=$(jq -r '.version' package.json)
GIT_TAG=$(git describe --exact-match --abbrev=0 2>/dev/null || echo "")
test "v${PKG_VERSION}" = "${GIT_TAG}"

- name: Use Node.js
uses: actions/setup-node@v1
- uses: actions/setup-node@v2
with:
node-version: '16'
node-version: '18'
check-latest: true

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.x

- name: Set up QEMU
id: qemu
uses: docker/setup-qemu-action@v1

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Install kubectl
run: |
curl -LO https://dl.k8s.io/release/v1.25.2/bin/linux/amd64/kubectl
chmod +x ./kubectl
sudo mv ./kubectl /usr/local/bin/kubectl

- name: Install Linode CLI
run: |
python -m pip install --upgrade pip
pip --version
pip install setuptools
pip install linode-cli --upgrade

- name: Prepare git
env:
GITHUB_USER: 1gtm
GITHUB_TOKEN: ${{ secrets.LGTM_GITHUB_TOKEN }}
run: |
set -x
git config --global user.name "${GITHUB_USER}"
git config --global user.email "${GITHUB_USER}@appscode.com"
git config --global \
url."https://${GITHUB_USER}:${GITHUB_TOKEN}@github.com".insteadOf \
"https://github.com"

- name: Install GitHub CLI
run: |
curl -fsSL https://github.com/github/hub/raw/master/script/get | bash -s 2.14.1
sudo mv bin/hub /usr/local/bin

- name: Install yq
run: |
curl -fsSL -o yqq https://github.com/mikefarah/yq/releases/download/3.3.0/yq_linux_amd64
Expand All @@ -50,26 +88,28 @@ jobs:
chmod +x hugo-tools
sudo mv hugo-tools /usr/local/bin/hugo-tools

- name: Install Firebase CLI
- name: Build
run: |
npm i -g [email protected]
npm ci
npm run build

- name: QA
- name: Publish to GitHub Container Registry
env:
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
GOOGLE_CUSTOM_SEARCH_API_KEY: ${{ secrets.GOOGLE_CUSTOM_SEARCH_API_KEY }}
if: startsWith(github.event.ref, 'refs/tags/') && (contains(github.ref, '-alpha.') || contains(github.ref, '-beta.'))
REGISTRY: ghcr.io/appscode
DOCKER_TOKEN: ${{ secrets.LGTM_GITHUB_TOKEN }}
USERNAME: 1gtm
GITHUB_USER: 1gtm
GITHUB_TOKEN: ${{ secrets.LGTM_GITHUB_TOKEN }}
run: |
npm install
make docs
make qa
docker login ghcr.io --username ${USERNAME} --password ${DOCKER_TOKEN}
npm run docker-release

- name: Release
- name: Deploy to QA
env:
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
GOOGLE_CUSTOM_SEARCH_API_KEY: ${{ secrets.GOOGLE_CUSTOM_SEARCH_API_KEY }}
if: ${{ github.event_name == 'schedule' }} || (startsWith(github.event.ref, 'refs/tags/') && (contains(github.ref, '-alpha.') || contains(github.ref, '-beta.')) == false)
REGISTRY: ghcr.io/appscode
LINODE_CLI_TOKEN: ${{ secrets.LINODE_CLI_TOKEN }}
run: |
npm install
make docs
make release
mkdir -p ~/.kube
linode-cli lke kubeconfig-view 19953 --json | jq -r .[0].kubeconfig | base64 -d > ~/.kube/config
kubectl get nodes
make deploy-to-linode
75 changes: 75 additions & 0 deletions .github/workflows/release_old.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Release_OLD

on:
push:
tags:
- "*.*"
schedule:
- cron: '0 0 * * *'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true

jobs:
build:
name: Build
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v1

- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ^1.21
id: go

- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: '18'
check-latest: true

- name: Install yq
run: |
curl -fsSL -o yqq https://github.com/mikefarah/yq/releases/download/3.3.0/yq_linux_amd64
chmod +x yqq
sudo mv yqq /usr/local/bin/yqq
pip3 install yq

- name: Install Hugo
run: |
curl -fsSL -o hugo_extended.deb https://github.com/gohugoio/hugo/releases/download/v0.111.1/hugo_extended_0.111.1_linux-amd64.deb
sudo dpkg -i hugo_extended.deb

- name: Install Hugo Tools
run: |
curl -fsSL -o hugo-tools https://github.com/appscodelabs/hugo-tools/releases/download/v0.2.23/hugo-tools-linux-amd64
chmod +x hugo-tools
sudo mv hugo-tools /usr/local/bin/hugo-tools

- name: Install Firebase CLI
run: |
npm i -g [email protected]

- name: QA
env:
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
GOOGLE_CUSTOM_SEARCH_API_KEY: ${{ secrets.GOOGLE_CUSTOM_SEARCH_API_KEY }}
if: startsWith(github.event.ref, 'refs/tags/') && (contains(github.ref, '-alpha.') || contains(github.ref, '-beta.'))
run: |
npm install
make docs
make qa

- name: Release
env:
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
GOOGLE_CUSTOM_SEARCH_API_KEY: ${{ secrets.GOOGLE_CUSTOM_SEARCH_API_KEY }}
if: ${{ github.event_name == 'schedule' }} || (startsWith(github.event.ref, 'refs/tags/') && (contains(github.ref, '-alpha.') || contains(github.ref, '-beta.')) == false)
run: |
npm install
make docs
make release
16 changes: 16 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM nginx:1.25-alpine

ARG TARGETOS
ARG TARGETARCH

RUN set -x \
&& apk add --update ca-certificates curl

# Set workdir to the NGINX default dir.
WORKDIR /usr/share/nginx/html

# Copy HTML from previous build into the Workdir.
COPY public .

# Expose port 80
EXPOSE 80/tcp
Loading
Loading