-
Notifications
You must be signed in to change notification settings - Fork 7
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 #38 from guidemetothemoon/master
Added support for Harry Potter category, Sprint Name Generator Docker image, div improvements
- Loading branch information
Showing
14 changed files
with
4,120 additions
and
2,561 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 |
---|---|---|
|
@@ -8,12 +8,15 @@ jobs: | |
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
env: | ||
IMAGE_NAME: ${{ secrets.DOCKER_HUB_USERNAME }} | ||
|
||
steps: | ||
|
||
- name: Set up Go 1.13 | ||
- name: Set up Go 1.18 | ||
uses: actions/setup-go@v1 | ||
with: | ||
go-version: 1.13 | ||
go-version: 1.18 | ||
id: go | ||
|
||
- name: Check out code into the Go module directory | ||
|
@@ -28,35 +31,54 @@ jobs: | |
fi | ||
- name: Build api | ||
run: go build -v -o name-gen github.com/flostadler/name-generator/cmd/name-generator | ||
run: go build -v -o main ${{ github.workspace }}/cmd/name-generator | ||
|
||
- name: Build wasm | ||
run: GOOS=js GOARCH=wasm go build -o web/generator.wasm github.com/flostadler/name-generator/cmd/web | ||
run: GOOS=js GOARCH=wasm go build -o web/generator.wasm ${{ github.workspace }}/cmd/web | ||
|
||
- name: Copy wasm_exec | ||
run: cp $GOROOT/misc/wasm/wasm_exec.js web/wasm_exec.js | ||
run: cp $GOROOT/misc/wasm/wasm_exec.js ${{ github.workspace }}/web/wasm_exec.js | ||
|
||
- name: Use Node.js 12.x | ||
- name: Use Node.js 14.x | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: 12.x | ||
node-version: 14.x | ||
|
||
- run: npm install | ||
working-directory: ./web | ||
working-directory: ${{ github.workspace }}/web | ||
|
||
- run: npm run build --if-present | ||
working-directory: ./web | ||
working-directory: ${{ github.workspace }}/web | ||
env: | ||
CI: true | ||
|
||
- name: Login to Docker Hub | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKER_HUB_USERNAME }} | ||
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | ||
|
||
- name: Build Docker image | ||
run: docker build . -f ${{ github.workspace }}/build/package/Dockerfile -t ${{ env.IMAGE_NAME }}/sprint-name-generator:${{github.run_number}} | ||
|
||
- name: Run container image security scan | ||
uses: Azure/container-scan@v0 | ||
with: | ||
image-name: ${{ env.IMAGE_NAME }}/sprint-name-generator:${{github.run_number}} | ||
severity-threshold: CRITICAL | ||
run-quality-checks: true | ||
|
||
- name: Push Docker image | ||
run: docker push ${{ env.IMAGE_NAME }}/sprint-name-generator:${{github.run_number}} | ||
|
||
- name: Install SSH Client | ||
uses: webfactory/[email protected] | ||
with: | ||
ssh-private-key: ${{ secrets.DEPLOY_KEY }} | ||
|
||
- name: Deploy Page | ||
uses: JamesIves/github-pages-deploy-action@releases/v3 | ||
with: | ||
SSH: true | ||
BRANCH: gh-pages | ||
FOLDER: web/build | ||
FOLDER: ${{ github.workspace }}/web/build |
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,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2022 Florian Stadler | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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,46 @@ | ||
# Sprint-Name-Generator | ||
[Sprint Name Generator](https://sprintnamegenerator.com) | ||
|
||
Built by: | ||
- [Florian Stadler](https://github.com/flostadler) - Go -> Wasm | ||
- [Wolfgang Ederer](https://github.com/wederer) - Frontend | ||
|
||
## Usage | ||
|
||
### Build the image locally | ||
|
||
You will need to run a few commands to get necessary files generated. | ||
|
||
1. Set environment variables: | ||
|
||
* `GOROOT=[path to Go installation folder]` | ||
* `GOOS=js` | ||
* `GOARCH=wasm` | ||
|
||
2. Run below commands: | ||
|
||
``` bash | ||
go build -o web/generator.wasm cmd/web | ||
cp $GOROOT/misc/wasm/wasm_exec.js web/wasm_exec.js | ||
cd web | ||
npm install | ||
npm run build --if-present | ||
|
||
docker build -t sprint-name-generator -f build/package/Dockerfile . | ||
``` | ||
|
||
3. Start the container: | ||
|
||
`docker run -dp 3000:80 sprint-name-generator:latest` | ||
|
||
### Run latest image from Docker Hub | ||
``` bash | ||
docker pull guidemetothemoon/sprint-name-generator:[image_tag] | ||
docker run -dp 3006:80 guidemetothemoon/sprint-name-generator:[image_tag] | ||
``` | ||
|
||
## Images | ||
|
||
Original prebuilt image available at [Dockerhub](https://hub.docker.com/r/flostadler/name-generator) | ||
|
||
Updated, newest image available at [guidemetothemoon/sprint-name-generator](https://hub.docker.com/r/guidemetothemoon/sprint-name-generator) |
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,14 +1,3 @@ | ||
FROM golang:alpine as builder | ||
RUN mkdir /build | ||
ADD . /build/ | ||
COPY go.mod /go/src/github.com/flostadler/name-generator/cmd/name-generator/go.mod | ||
COPY go.sum /go/src/github.com/flostadler/name-generator/cmd/name-generator/go.sum | ||
RUN apk add git | ||
WORKDIR /build | ||
RUN go mod download | ||
RUN go build -o main github.com/flostadler/name-generator/cmd/name-generator | ||
FROM alpine | ||
EXPOSE 80 | ||
COPY --from=builder /build/main /app/ | ||
WORKDIR /app | ||
CMD ["./main"] | ||
FROM nginx:latest | ||
COPY web/build /usr/share/nginx/html/ | ||
EXPOSE 80 |
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,8 +1,8 @@ | ||
module github.com/flostadler/name-generator | ||
|
||
go 1.13 | ||
go 1.18 | ||
|
||
require ( | ||
github.com/docker/docker v1.13.1 | ||
github.com/gorilla/mux v1.7.1 | ||
github.com/docker/docker v20.10.17+incompatible | ||
github.com/gorilla/mux v1.8.0 | ||
) |
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,4 +1,4 @@ | ||
github.com/docker/docker v1.13.1 h1:IkZjBSIc8hBjLpqeAbeE5mca5mNgeatLHBy3GO78BWo= | ||
github.com/docker/docker v1.13.1/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= | ||
github.com/gorilla/mux v1.7.1 h1:Dw4jY2nghMMRsh1ol8dv1axHkDwMQK2DHerMNJsIpJU= | ||
github.com/gorilla/mux v1.7.1/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= | ||
github.com/docker/docker v20.10.17+incompatible h1:JYCuMrWaVNophQTOrMMoSwudOVEfcegoZZrleKc1xwE= | ||
github.com/docker/docker v20.10.17+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= | ||
github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI= | ||
github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= |
Oops, something went wrong.