-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from as207414:release-2.1
Release-2.1
- Loading branch information
Showing
16 changed files
with
345 additions
and
255 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
name: Build and push AS207414 UI Binaries & Docker Images | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
|
||
jobs: | ||
|
||
gitversion: | ||
name: Determine the intended website version | ||
runs-on: ubuntu-latest | ||
outputs: | ||
majorminorpatch: ${{ steps.gitversion.outputs.majorMinorPatch }} | ||
semver: ${{ steps.gitversion.outputs.semVer }} | ||
shortsha: ${{ steps.gitversion.outputs.shortSha }} | ||
branchname: ${{ steps.gitversion.outputs.branchName }} | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Install GitVersion | ||
uses: gittools/actions/gitversion/[email protected] | ||
with: | ||
versionSpec: '5.x' | ||
|
||
- name: Determine Version | ||
id: gitversion | ||
uses: gittools/actions/gitversion/[email protected] | ||
|
||
go-version: | ||
name: "Determine Go toolchain version" | ||
runs-on: ubuntu-latest | ||
outputs: | ||
go-version: ${{ steps.version.outputs.go-version }} | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Determine Go version | ||
id: version | ||
run: | | ||
echo "Building with Go $(cat .go-version)" | ||
echo "::set-output name=go-version::$(cat .go-version)" | ||
build: | ||
name: Build for linux_amd64 | ||
runs-on: ubuntu-latest | ||
env: | ||
SEMVER: ${{ needs.gitversion.outputs.semver }} | ||
SHORTSHA: ${{ needs.gitversion.outputs.shortsha }} | ||
MAJORMINORPATCH: ${{ needs.gitversion.outputs.majorminorpatch }} | ||
BRANCH: ${{ needs.gitversion.outputs.branchname }} | ||
GOVER: ${{ needs.go-version.outputs.go-version }} | ||
GOOS: linux | ||
GOARCH: amd64 | ||
needs: | ||
- gitversion | ||
- go-version | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Install Go toolchain | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: ${{ needs.go-version.outputs.go-version }} | ||
- name: Build binaries | ||
env: | ||
CGO_ENABLED: 0 | ||
MAIN_VERSION: -X main.version=${{ env.MAJORMINORPATCH }} | ||
MAIN_OS_VER: -X main.os_ver=${{ env.GOOS }} | ||
MAIN_OS_ARC: -X main.os_arc=${{ env.GOARCH }} | ||
MAIN_GO_VER: -X main.go_ver=${{ env.GOVER }} | ||
MAIN_GIT_SHA: -X main.git_sha=${{ env.SHORTSHA }} | ||
run: | | ||
go build -a -installsuffix cgo \ | ||
-ldflags "-w -s ${{ env.MAIN_VERSION }} ${{ env.MAIN_OS_VER }} ${{ env.MAIN_OS_ARC }} ${{ env.MAIN_GO_VER }} ${{ env.MAIN_GIT_SHA }}" \ | ||
-o=bin/as207414_linux_amd64 \ | ||
./cmd/ui && \ | ||
chmod +x bin/as207414_linux_amd64 && \ | ||
cp bin/as207414_linux_amd64 build/docker/as207414_linux_amd64 | ||
- name: Login to Dockerhub | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKER_HUB_USERNAME }} | ||
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | ||
- name: Login to Github Packages | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: ghcr.io | ||
username: ganawa | ||
password: ${{ secrets.GHP_TOKEN }} | ||
- name: Build and push development docker image | ||
if: contains(env.BRANCH, 'develop') || startsWith(env.BRANCH, 'release') || startsWith(env.BRANCH, 'hotfix') | ||
run: | | ||
cd build/docker | ||
docker build . \ | ||
-t ${{ secrets.DOCKER_HUB_USERNAME }}/as207414-ui:${{ env.SEMVER }} \ | ||
-t ghcr.io/${{ github.repository_owner }}/as207414-ui:${{ env.SEMVER }} | ||
docker push ${{ secrets.DOCKER_HUB_USERNAME }}/as207414-ui:${{ env.SEMVER }} | ||
docker push ghcr.io/${{ github.repository_owner }}/as207414-ui:${{ env.SEMVER }} | ||
- name: Build and push main/latest docker image | ||
if: contains(env.BRANCH, 'main') | ||
run: | | ||
cd build/docker | ||
docker build . \ | ||
-t ${{ secrets.DOCKER_HUB_USERNAME }}/as207414-ui:latest \ | ||
-t ghcr.io/${{ github.repository_owner }}/as207414-ui:latest | ||
docker push ${{ secrets.DOCKER_HUB_USERNAME }}/as207414-ui:latest | ||
docker push ghcr.io/${{ github.repository_owner }}/as207414-ui:latest | ||
- name: Build and push non-tagged docker image | ||
if: "!startsWith(env.BRANCH, 'develop') && !startsWith(env.BRANCH, 'release') && !startsWith(env.BRANCH, 'hotfix') && !startsWith(env.branchName, 'main')" | ||
run: | | ||
cd build/docker | ||
docker build . \ | ||
-t ${{ secrets.DOCKER_HUB_USERNAME }}/as207414-ui:${{ env.SHORTSHA }} \ | ||
-t ghcr.io/${{ github.repository_owner }}/as207414-ui:${{ env.SHORTSHA }} | ||
docker push ${{ secrets.DOCKER_HUB_USERNAME }}/as207414-ui:${{ env.SHORTSHA }} | ||
docker push ghcr.io/${{ github.repository_owner }}/as207414-ui:${{ env.SHORTSHA }} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,52 @@ | ||
# AS207414.net Website | ||
Source code for AS207414.net | ||
# [AS207414.net](https://github.com/linuxserver/docker-netbox) | ||
[![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/as207414/as207414.net?logo=github&style=for-the-badge)](https://github.com/as207414/as207414.net/releases) | ||
[![Docker Image Version (latest semver)](https://img.shields.io/docker/v/ganawa/as207414-ui?logo=docker&style=for-the-badge)](https://hub.docker.com/repository/docker/ganawa/as207414-ui) | ||
[![Website](https://img.shields.io/website?style=for-the-badge&url=https%3A%2F%2Fas207414.net)](https://as207414.net) | ||
[![GitHub go.mod Go version](https://img.shields.io/github/go-mod/go-version/as207414/as207414.net?style=for-the-badge)](https://github.com/as207414/as207414.net/blob/develop/go.mod) | ||
[![GitHub](https://img.shields.io/github/license/as207414/as207414.net?style=for-the-badge)](https://github.com/as207414/as207414.net/blob/develop/LICENSE) | ||
|
||
### Requirements | ||
Source code for [AS207414.net](https://as207414.net) | ||
|
||
* Flask == 1.1.1 | ||
* gunicorn == 20.0.4 | ||
|
||
### Installation instructions | ||
## Usage | ||
|
||
### docker-compose | ||
|
||
```yaml | ||
--- | ||
version: "3" | ||
services: | ||
as207414: | ||
image: ganawa/as207414-ui:latest | ||
container_name: web | ||
ports: | ||
- 4000:4000 | ||
restart: unless-stopped | ||
``` | ||
### docker cli | ||
```bash | ||
git clone https://github.com/AS207414/asn_website.git | ||
cd asn_website | ||
docker-compose up | ||
docker run -d \ | ||
--name=web \ | ||
-p 4000:4000 \ | ||
--restart unless-stopped \ | ||
ganawa/as207414-ui:latest | ||
``` | ||
|
||
### Runing the server in development mode | ||
The website runs as a container, so simply run: | ||
|
||
## Building locally | ||
|
||
|
||
If you want to make local modifications to these images for development purposes or just to customize the logic: | ||
|
||
```bash | ||
docker-compose up | ||
git clone https://github.com/as207414/as207414.net | ||
make run/ui # Runs the local code using Go | ||
make build/ui # Builds binaries to bin/ | ||
make buid/ui/docker DOCKER_IMAGE_NAME={IMAGE NAME} | ||
make run/ui/docker DOCKER_IMAGE_NAME={IMAGE NAME} # Runs built docker image | ||
``` | ||
|
||
# Thanks | ||
|
||
To Alex Edward's great books [Let's Go](https://lets-go.alexedwards.net/) and [Let's Go Further](https://lets-go-further.alexedwards.net/) where most of this code was from and modified for te site. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,22 @@ | ||
package main | ||
|
||
import ( | ||
"net/http" | ||
"net/http" | ||
) | ||
|
||
func (app *application) index(w http.ResponseWriter, r *http.Request) { | ||
|
||
if r.URL.Path != "/" { | ||
http.NotFound(w, r) | ||
return | ||
} | ||
http.NotFound(w, r) | ||
return | ||
} | ||
|
||
app.render(w, r, "index.page.html") | ||
app.render(w, r, "index.page.html") | ||
|
||
} | ||
|
||
func (app *application) peering(w http.ResponseWriter, r *http.Request) { | ||
|
||
app.render(w, r, "peering.page.html") | ||
app.render(w, r, "peering.page.html") | ||
|
||
} | ||
} |
Oops, something went wrong.