Merge pull request 'fix/flags_and_build' (#4) from fix/flags_and_build into main
Reviewed-on: #4
This commit is contained in:
commit
22ec82a326
21
.github/workflows/build-on-branch.yml
vendored
Normal file
21
.github/workflows/build-on-branch.yml
vendored
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
name: Build tag
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- 'main'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Build
|
||||||
|
run: docker build . -t tandrade/short:$(echo $([[ $(git rev-parse --abbrev-ref HEAD) == master ]] && echo latest || echo latest-modsec))
|
||||||
|
- name: Login
|
||||||
|
uses: docker/login-action@v1.10.0
|
||||||
|
with:
|
||||||
|
username: tandrade
|
||||||
|
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
|
||||||
|
- name: Push
|
||||||
|
run: docker push tandrade/short:$(echo $([[ $(git rev-parse --abbrev-ref HEAD) == master ]] && echo latest || echo latest-modsec))
|
21
.github/workflows/build-on-tag.yml
vendored
Normal file
21
.github/workflows/build-on-tag.yml
vendored
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
name: Build tag
|
||||||
|
|
||||||
|
on:
|
||||||
|
create:
|
||||||
|
tags:
|
||||||
|
- 'v*'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Build
|
||||||
|
run: docker build . -t tandrade/short:${GITHUB_REF/refs\/tags\//}
|
||||||
|
- name: Login
|
||||||
|
uses: docker/login-action@v1.10.0
|
||||||
|
with:
|
||||||
|
username: tandrade
|
||||||
|
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
|
||||||
|
- name: Push
|
||||||
|
run: docker push tandrade/short:${GITHUB_REF/refs\/tags\//}
|
@ -2,7 +2,7 @@ FROM golang:1.18 as builder
|
|||||||
|
|
||||||
ENV CGO_ENABLED=0
|
ENV CGO_ENABLED=0
|
||||||
|
|
||||||
ADD main.go go.* /go/src/short/
|
COPY . /go/src/short/
|
||||||
|
|
||||||
WORKDIR /go/src/short
|
WORKDIR /go/src/short
|
||||||
|
|
||||||
|
2
main.go
2
main.go
@ -64,7 +64,7 @@ func main() {
|
|||||||
addr = flag.String("addr", "localhost", "Address to listen for connections")
|
addr = flag.String("addr", "localhost", "Address to listen for connections")
|
||||||
domain = flag.String("domain", "localhost", "Domain to write to the URLs")
|
domain = flag.String("domain", "localhost", "Domain to write to the URLs")
|
||||||
path = flag.String("path", "", "Path to the base URL (https://localhost/PATH/...")
|
path = flag.String("path", "", "Path to the base URL (https://localhost/PATH/...")
|
||||||
http = flag.Bool("http", true, "proto to the base URL (HTTPS://localhost/path/... no real https here just to set the url (for like a proxy offloading https")
|
http = flag.Bool("http", false, "proto to the base URL (HTTPS://localhost/path/... no real https here just to set the url (for like a proxy offloading https")
|
||||||
port = flag.Int("port", 8080, "Port to listen for connections")
|
port = flag.Int("port", 8080, "Port to listen for connections")
|
||||||
exp = flag.Int("exp", 240, "Default expiration time in hours, default 240")
|
exp = flag.Int("exp", 240, "Default expiration time in hours, default 240")
|
||||||
cleanup = flag.Int("cleanup", 1, "Cleanup interval in hours, default 1")
|
cleanup = flag.Int("cleanup", 1, "Cleanup interval in hours, default 1")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user