-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
788 changed files
with
330,209 additions
and
70 deletions.
There are no files selected for viewing
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,3 +1,6 @@ | ||
Dockerfile | ||
.git | ||
CHANGELOG | ||
README.md | ||
builds | ||
wordchain |
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,7 @@ | ||
version: 2 | ||
updates: | ||
# Maintain dependencies for GitHub Actions | ||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
interval: "weekly" |
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,43 @@ | ||
name: Build Container Image | ||
|
||
on: | ||
push: | ||
branches: | ||
- 'main' | ||
|
||
jobs: | ||
buildx: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- | ||
name: Checkout | ||
uses: actions/checkout@v2 | ||
- | ||
name: Set up QEMU | ||
uses: docker/setup-qemu-action@v1 | ||
- | ||
name: Set up Docker Buildx | ||
id: buildx | ||
uses: docker/setup-buildx-action@v1 | ||
- | ||
name: Available platforms | ||
run: echo ${{ steps.buildx.outputs.platforms }} | ||
- | ||
name: Login to DockerHub | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
- | ||
name: Build and push | ||
id: docker_build | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
platforms: linux/amd64,linux/arm64,linux/arm/v7 | ||
push: true | ||
tags: superorbital/wordchain:latest | ||
- | ||
name: Image digest | ||
run: echo ${{ steps.docker_build.outputs.digest }} | ||
|
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,2 +1,3 @@ | ||
wordchain | ||
.DS_Store | ||
/wordchain | ||
builds |
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,14 @@ | ||
# Changelog | ||
All notable changes to this project will be documented in this file. | ||
|
||
The format is loosely based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), | ||
|
||
## [Unreleased] | ||
|
||
## [1.0.0] - 2021-03-30 | ||
### Added | ||
- Added command line support | ||
- Added micro service (listener) mode | ||
- Confirmed basic Go Library functionality | ||
- More details in the README | ||
|
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,23 +1,29 @@ | ||
FROM golang:1.16-alpine3.13 AS build | ||
ARG ARCH= | ||
FROM ${ARCH}golang:1.16-alpine3.13 AS build | ||
|
||
RUN apk --no-cache add \ | ||
bash \ | ||
gcc \ | ||
musl-dev \ | ||
openssl | ||
RUN mkdir -p /go/src/github.com/superorbital/wordchain | ||
WORKDIR /go/src/github.com/superorbital/wordchain | ||
ADD . /go/src/github.com/superorbital/wordchain | ||
|
||
ENV CGO_ENABLED=0 | ||
|
||
COPY . /build | ||
WORKDIR /build | ||
|
||
RUN go get github.com/markbates/pkger/cmd/pkger && \ | ||
pkger -include /data/words.json && \ | ||
go build -mod=vendor --ldflags '-linkmode external -extldflags "-static"' . | ||
go build . | ||
|
||
FROM alpine:3.13 AS deploy | ||
FROM ${ARCH}alpine:3.13 AS deploy | ||
|
||
WORKDIR / | ||
COPY --from=build /go/src/github.com/superorbital/wordchain/wordchain / | ||
COPY --from=build /build/wordchain / | ||
|
||
USER 500 | ||
EXPOSE 8080 | ||
|
||
ENTRYPOINT ["/wordchain"] | ||
CMD ["random"] | ||
CMD ["listen"] | ||
|
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 |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
Copyright © 2021 SuperOrbital, LLC <[email protected]> | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
package cmd | ||
|
||
import ( | ||
"github.com/spf13/cobra" | ||
"github.com/superorbital/wordchain/listen" | ||
types "github.com/superorbital/wordchain/types" | ||
) | ||
|
||
var settings types.Listener | ||
|
||
// listenCmd represents the listen command | ||
var listenCmd = &cobra.Command{ | ||
Use: "listen", | ||
Short: "Listen on a port for requests to generate wordchains", | ||
Long: `This launches the application as a long running service that will respond to a JSON request with a wordchain`, | ||
Run: func(cmd *cobra.Command, args []string) { | ||
listen.Listen(prefs, settings) | ||
}, | ||
} | ||
|
||
func init() { | ||
rootCmd.AddCommand(listenCmd) | ||
|
||
// Here you will define your flags and configuration settings. | ||
|
||
// Cobra supports Persistent Flags which will work for this command | ||
// and all subcommands, e.g.: | ||
// listenCmd.PersistentFlags().String("foo", "", "A help for foo") | ||
|
||
// Cobra supports local flags which will only run when this command | ||
// is called directly, e.g.: | ||
// listenCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle") | ||
listenCmd.Flags().IntVar(&settings.Port, "port", 8080, "Port to bind to") | ||
} |
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
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
Oops, something went wrong.