From 64c0446453df40bce06a492e4575dc64df627c89 Mon Sep 17 00:00:00 2001 From: Gabriel Simmer Date: Sat, 19 Mar 2022 12:52:20 +0000 Subject: [PATCH] Update project to go mod, proper Docker support, CI. --- .dockerignore | 4 + .github/workflows/dev-docker-build-push.yml | 28 +++++++ .github/workflows/docker-build-push.yml | 28 +++++++ .gitignore | 2 + Dockerfile | 35 ++++----- Godeps/Godeps.json | 51 ------------- Godeps/Readme | 5 -- assets/config/config.json | 9 +-- assets/web/admin.html | 26 +------ assets/web/index.html | 82 +-------------------- 10 files changed, 79 insertions(+), 191 deletions(-) create mode 100644 .github/workflows/dev-docker-build-push.yml create mode 100644 .github/workflows/docker-build-push.yml delete mode 100644 Godeps/Godeps.json delete mode 100644 Godeps/Readme diff --git a/.dockerignore b/.dockerignore index a3b6b46..5210f77 100644 --- a/.dockerignore +++ b/.dockerignore @@ -22,3 +22,7 @@ feed\.rss .travis\.yml _config\.yml + +Dockerfile + +assets/ diff --git a/.github/workflows/dev-docker-build-push.yml b/.github/workflows/dev-docker-build-push.yml new file mode 100644 index 0000000..dc6ae8c --- /dev/null +++ b/.github/workflows/dev-docker-build-push.yml @@ -0,0 +1,28 @@ +name: push gmemstr/pogo:dev + +on: + push: + paths: + - '**.go' + branches-ignore: + - 'master' + +jobs: + docker: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - + name: Login to DockerHub + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: gmemstr + password: ${{ secrets.GITHUB_TOKEN }} + - + name: Build and push + id: docker_build + uses: docker/build-push-action@v2 + with: + push: true + tags: ghcr.io/gmemstr/pogo:dev diff --git a/.github/workflows/docker-build-push.yml b/.github/workflows/docker-build-push.yml new file mode 100644 index 0000000..bee1e33 --- /dev/null +++ b/.github/workflows/docker-build-push.yml @@ -0,0 +1,28 @@ +name: push gmemstr/pogo:stable + +on: + push: + paths: + - '**.go' + branches: + - 'master' + +jobs: + docker: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - + name: Login to DockerHub + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: gmemstr + password: ${{ secrets.GITHUB_TOKEN }} + - + name: Build and push + id: docker_build + uses: docker/build-push-action@v2 + with: + push: true + tags: ghcr.io/gmemstr/pogo:stable diff --git a/.gitignore b/.gitignore index 5e8318f..c14f009 100644 --- a/.gitignore +++ b/.gitignore @@ -26,3 +26,5 @@ assets/config/users\.db run\.lockfile \.lock + +assets/ \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 8e93505..b159f90 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,28 +1,21 @@ -# Use latest golang image -FROM golang:latest +FROM golang:stretch as builder -RUN mkdir -p /go/src \ - && mkdir -p /go/bin \ - && mkdir -p /go/pkg -ENV GOPATH=/go -ENV PATH=$GOPATH/bin:$PATH +WORKDIR /build/pogo +COPY go.mod go.sum ./ +RUN go mod download -# Set working directory -WORKDIR $GOPATH/src/github.com/gmemstr/pogo +COPY . . -# Add source to container so we can build -ADD . $GOPATH/src/github.com/gmemstr/pogo +RUN GOOS=linux go build -ldflags "-s -w" -# 1. Install make and dependencies -# 2. Install Go dependencies -# 3. Build named Linux binary and allow execution -# 4. List directory structure (for debugging really)\ -# 5. Make empty podcast direcory -# 6. Create empty feed files -RUN go get github.com/tools/godep && \ - godep restore && \ - go build -o pogoapp && chmod +x pogoapp +FROM debian:stretch-slim + +RUN apt update && apt-get install -y ca-certificates && rm -rf /var/lib/apt/lists/* + +WORKDIR /app EXPOSE 3000 -CMD ./pogoapp +COPY --from=builder /build/pogo/pogo pogo + +ENTRYPOINT ["/app/pogo"] diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json deleted file mode 100644 index 1428fae..0000000 --- a/Godeps/Godeps.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "ImportPath": "github.com/gmemstr/pogo", - "GoVersion": "go1.8", - "GodepVersion": "v79", - "Deps": [ - { - "ImportPath": "github.com/fsnotify/fsnotify", - "Comment": "v1.4.2-6-g4da3e2c", - "Rev": "4da3e2cfbabc9f751898f250b49f2439785783a1" - }, - { - "ImportPath": "github.com/google/go-github/github", - "Rev": "fbfee053c26dab3772adfc7799d995eed379133e" - }, - { - "ImportPath": "github.com/google/go-querystring/query", - "Rev": "53e6ce116135b80d037921a7fdd5138cf32d7a8a" - }, - { - "ImportPath": "github.com/gorilla/feeds", - "Comment": "v1.0.0", - "Rev": "4b936b5221c53c99fcd4b15ac0b8c38ff490ab89" - }, - { - "ImportPath": "github.com/gorilla/mux", - "Comment": "v1.4.0-10-g18fca31", - "Rev": "18fca31550181693b3a834a15b74b564b3605876" - }, - { - "ImportPath": "github.com/mattn/go-sqlite3", - "Comment": "v1.3.0", - "Rev": "5160b48509cf5c877bc22c11c373f8c7738cdb38" - }, - { - "ImportPath": "golang.org/x/crypto/bcrypt", - "Rev": "9419663f5a44be8b34ca85f08abc5fe1be11f8a3" - }, - { - "ImportPath": "golang.org/x/crypto/blowfish", - "Rev": "9419663f5a44be8b34ca85f08abc5fe1be11f8a3" - }, - { - "ImportPath": "golang.org/x/net/context", - "Rev": "3da985ce5951d99de868be4385f21ea6c2b22f24" - }, - { - "ImportPath": "golang.org/x/sys/unix", - "Rev": "0b25a408a50076fbbcae6b7ac0ea5fbb0b085e79" - } - ] -} diff --git a/Godeps/Readme b/Godeps/Readme deleted file mode 100644 index 4cdaa53..0000000 --- a/Godeps/Readme +++ /dev/null @@ -1,5 +0,0 @@ -This directory tree is generated automatically by godep. - -Please do not edit. - -See https://github.com/tools/godep for more information. diff --git a/assets/config/config.json b/assets/config/config.json index d367062..820b6b9 100644 --- a/assets/config/config.json +++ b/assets/config/config.json @@ -1,8 +1 @@ -{ - "Name": "Pogo Test Feed", - "Host": "Gabriel Simmer", - "Email": "admin@localhost", - "Description": "Discussion about open source projects on the internet.", - "Image": "localhost:3000/assets/logo-xs.png", - "PodcastUrl": "http://localhost:3000" -} \ No newline at end of file +{"Name":"Pogo Podcast","Host":"John Doe","Email":"johndoe@localhost","Description":"A Podcast About Stuff","Image":"localhost:3000/assets/podcastimage.png","PodcastUrl":"http://localhost:3000"} \ No newline at end of file diff --git a/assets/web/admin.html b/assets/web/admin.html index 932e768..14f1187 100644 --- a/assets/web/admin.html +++ b/assets/web/admin.html @@ -1,25 +1 @@ - - - - - Pogo Publish - - - - -
-
- -

{{ header }}

- -
-
- - - - - - \ No newline at end of file +Pogo LAUNCHPAD (Admin)
\ No newline at end of file diff --git a/assets/web/index.html b/assets/web/index.html index 8a913c1..14ec1c9 100644 --- a/assets/web/index.html +++ b/assets/web/index.html @@ -1,81 +1 @@ - - - - - Pogo Loading - - - - - - - - -
-
-

Loading

-

Admin

- -
- -
-
-
-

Pogo licensed under the GPLv3 | RSS Feed -

-
- - - \ No newline at end of file +Pogo (Loading)
\ No newline at end of file