mirror of
https://github.com/gmemstr/pogo.git
synced 2024-09-20 01:31:09 +01:00
Update project to go mod, proper Docker support, CI.
This commit is contained in:
parent
6d86152969
commit
64c0446453
|
@ -22,3 +22,7 @@ feed\.rss
|
||||||
.travis\.yml
|
.travis\.yml
|
||||||
|
|
||||||
_config\.yml
|
_config\.yml
|
||||||
|
|
||||||
|
Dockerfile
|
||||||
|
|
||||||
|
assets/
|
||||||
|
|
28
.github/workflows/dev-docker-build-push.yml
vendored
Normal file
28
.github/workflows/dev-docker-build-push.yml
vendored
Normal file
|
@ -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
|
28
.github/workflows/docker-build-push.yml
vendored
Normal file
28
.github/workflows/docker-build-push.yml
vendored
Normal file
|
@ -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
|
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -26,3 +26,5 @@ assets/config/users\.db
|
||||||
run\.lockfile
|
run\.lockfile
|
||||||
|
|
||||||
\.lock
|
\.lock
|
||||||
|
|
||||||
|
assets/
|
35
Dockerfile
35
Dockerfile
|
@ -1,28 +1,21 @@
|
||||||
# Use latest golang image
|
FROM golang:stretch as builder
|
||||||
FROM golang:latest
|
|
||||||
|
|
||||||
RUN mkdir -p /go/src \
|
WORKDIR /build/pogo
|
||||||
&& mkdir -p /go/bin \
|
COPY go.mod go.sum ./
|
||||||
&& mkdir -p /go/pkg
|
RUN go mod download
|
||||||
ENV GOPATH=/go
|
|
||||||
ENV PATH=$GOPATH/bin:$PATH
|
|
||||||
|
|
||||||
# Set working directory
|
COPY . .
|
||||||
WORKDIR $GOPATH/src/github.com/gmemstr/pogo
|
|
||||||
|
|
||||||
# Add source to container so we can build
|
RUN GOOS=linux go build -ldflags "-s -w"
|
||||||
ADD . $GOPATH/src/github.com/gmemstr/pogo
|
|
||||||
|
|
||||||
# 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
|
EXPOSE 3000
|
||||||
|
|
||||||
CMD ./pogoapp
|
COPY --from=builder /build/pogo/pogo pogo
|
||||||
|
|
||||||
|
ENTRYPOINT ["/app/pogo"]
|
||||||
|
|
51
Godeps/Godeps.json
generated
51
Godeps/Godeps.json
generated
|
@ -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"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
5
Godeps/Readme
generated
5
Godeps/Readme
generated
|
@ -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.
|
|
|
@ -1,8 +1 @@
|
||||||
{
|
{"Name":"Pogo Podcast","Host":"John Doe","Email":"johndoe@localhost","Description":"A Podcast About Stuff","Image":"localhost:3000/assets/podcastimage.png","PodcastUrl":"http://localhost:3000"}
|
||||||
"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"
|
|
||||||
}
|
|
|
@ -1,25 +1 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html><html><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><title>Pogo LAUNCHPAD (Admin)</title><link href=/static/css/app.2c4137b696e2d4b140b031b27d7e5a1a.css rel=stylesheet></head><body><div id=app></div><script type=text/javascript src=/static/js/manifest.f80f6e311dcc9285e615.js></script><script type=text/javascript src=/static/js/vendor.5973cf24864eecc78c48.js></script><script type=text/javascript src=/static/js/app.1261f4d104eef89553c2.js></script></body></html>
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<title>Pogo Publish</title>
|
|
||||||
<link rel="stylesheet" href="/assets/styles.css">
|
|
||||||
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div class="container">
|
|
||||||
<div id="app">
|
|
||||||
<nav>
|
|
||||||
<router-link to="/publish">Publish</router-link> <router-link to="/manage">Episodes</router-link> <router-link to="/theme">Theme</router-link> <router-link to="/users">Users</router-link> <button onclick="logout()">Logout</button></nav>
|
|
||||||
<h1>{{ header }}</h1>
|
|
||||||
<router-view></router-view>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<footer>
|
|
||||||
<p>Pogo licensed under the GPLv3</p>
|
|
||||||
</footer>
|
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.8/vue.min.js"></script>
|
|
||||||
<script src="https://unpkg.com/vue-router@2.7.0/dist/vue-router.js"></script>
|
|
||||||
<script src="/assets/app.js"></script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -1,81 +1 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html><html><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><title>Pogo (Loading)</title><link href=/static/css/app.d30c73e61cece4af1cf90f7dfb3c4e01.css rel=stylesheet></head><body><div id=app></div><script></script><script type=text/javascript src=/static/js/manifest.d89179d976625d3cea09.js></script><script type=text/javascript src=/static/js/vendor.c5c1444b51671198fd20.js></script><script type=text/javascript src=/static/js/app.415e639459f313d89125.js></script></body></html>
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<title>Pogo Loading</title>
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
||||||
|
|
||||||
<link rel="stylesheet" href="/assets/styles.css">
|
|
||||||
|
|
||||||
<!-- Custom CSS stylings from admin -->
|
|
||||||
<link rel="stylesheet" href="/assets/custom.css">
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div class="container">
|
|
||||||
<div class="main">
|
|
||||||
<h1 id="title" class="title">Loading</h1>
|
|
||||||
<h3><a href="/admin" class="adminlink">Admin</a></h3>
|
|
||||||
|
|
||||||
<div id="podcasts" class="podcastlist">
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<footer>
|
|
||||||
<p>Pogo licensed under the GPLv3 | <a href="/rss">RSS Feed</a>
|
|
||||||
</footer>
|
|
||||||
</div>
|
|
||||||
<script>
|
|
||||||
/*
|
|
||||||
* Function for aggregating podcast episodes and
|
|
||||||
* displaying them.
|
|
||||||
*
|
|
||||||
* Will not be written in ES6 _yet_ until all browsers
|
|
||||||
* support it, avoiding frameworks because of bulk.
|
|
||||||
*/
|
|
||||||
get("/json", function(data){
|
|
||||||
json = JSON.parse(data);
|
|
||||||
document.title = json.title;
|
|
||||||
document.getElementById("title").innerHTML = json.title + " DEVELOPMENT MODE";
|
|
||||||
|
|
||||||
// Iterate through JSON
|
|
||||||
for (i=0;i<json.items.length; i++){
|
|
||||||
var div = document.createElement('div');
|
|
||||||
div.className = 'podcastitem';
|
|
||||||
|
|
||||||
// Hacky date workaround - convert our Go date output to unix timestamp,
|
|
||||||
// then convert that into a string
|
|
||||||
// Leaves RSS readers happy and date readable on the frontend.
|
|
||||||
date = new Date(Date.parse(json.items[i].date_published))
|
|
||||||
month = date.getMonth()+1;
|
|
||||||
datestring = date.getDate() + "/" + month + "/" + date.getFullYear();
|
|
||||||
|
|
||||||
// Build div for podcast entry
|
|
||||||
div.innerHTML = '<h3 class="podcasttitle">'+
|
|
||||||
json.items[i].title+' <small class="podcastdate">'+
|
|
||||||
datestring+'</small></h3><p class="podcastdesc">'+
|
|
||||||
json.items[i].summary+'</p><audio controls class="podcastaudio"><source src="'+
|
|
||||||
json.items[i].url+'">';
|
|
||||||
|
|
||||||
// We can safely do this because of how the Go code actually
|
|
||||||
// generates the .json file - it's consistent as far as I've been able to see
|
|
||||||
// Preappend so newest is at the top
|
|
||||||
var element = document.getElementById("podcasts");
|
|
||||||
element.insertBefore(div, element.firstChild);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Wrap xmlHttp into smaller function, I like
|
|
||||||
// to include this function whenever I need to
|
|
||||||
// do such a thing
|
|
||||||
function get(url, callback) {
|
|
||||||
var xmlHttp = new XMLHttpRequest();
|
|
||||||
xmlHttp.onreadystatechange = function() {
|
|
||||||
if (xmlHttp.readyState == 4 && xmlHttp.status == 200)
|
|
||||||
callback(xmlHttp.responseText);
|
|
||||||
}
|
|
||||||
xmlHttp.open("GET", url, true);
|
|
||||||
xmlHttp.send(null);
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
Loading…
Reference in a new issue