dockerize a bit more
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Jeffrey Paul 2020-03-24 21:05:23 -07:00
parent f8d5b6c614
commit c8cd1d773e
3 changed files with 29 additions and 11 deletions

View File

@ -14,11 +14,19 @@ RUN tar cvfz go-src.tgz src && du -sh *
FROM alpine
COPY --from=builder /go/src/git.eeqj.de/sneak/hntransparencylog/server /bin/server
RUN mkdir -p /app/bin
COPY --from=builder /go/src/git.eeqj.de/sneak/hntransparencylog/server /app/bin/server
# FIXME figure out how to embed these stupid templates
COPY --from=builder /go/src/git.eeqj.de/sneak/hntransparencylog/view /app/view
# put the source in there too for safekeeping
COPY --from=builder /go/go-src.tgz /usr/local/src/go-src.tgz
CMD /bin/server
# this is where the db gets stored:
VOLUME /data
WORKDIR /app
CMD /app/bin/server
# FIXME add testing

View File

@ -73,9 +73,15 @@ func (a *App) init() {
// open db
// FIXME make configurable path
db, err := gorm.Open("sqlite3", "storage.db")
DATABASE_PATH := "/data/storage.sqlite"
if os.Getenv("DATABASE_PATH") != "" {
DATABASE_PATH = os.Getenv("DATABASE_PATH")
}
db, err := gorm.Open("sqlite3", DATABASE_PATH)
if err != nil {
panic("failed to connect database")
panic("failed to open database: " + err)
}
a.db = db
}

View File

@ -3,27 +3,31 @@
{% block content %}
<div class="col-lg-12">
<h1>About</h1>
<br />
<h1>About This Site</h1>
<h2>First Let's Get One Thing Straight</h2>
<h2>IMPORTANT</h2>
<p>This is a third-party site, not affiliated with HN, provided for
informational purposes only. <b>Do not</b> contact or hassle HN
administrators about any information you learn here.</p>
administrators about any information you learn here. Their site,
their rules. I repeat: <b>Do not hassle or interrogate the HN admins.</b>
</p>
<h2>Why?</h2>
<p>I like reading stuff on the internet that is of interest to HN voters,
even if the HN administrators think it's off topic.</p>
even if the HN administrators think it's off topic and don't want it on
the frontpage, which is a decision I respect. Again, their site, their
rules.</p>
<h2>How?</h2>
<p><a href="https://git.eeqj.de/sneak/hntransparencylog">Go</a> and the
graciously-provided <a href="https://github.com/HackerNews/API">HN
graciously provided <a href="https://github.com/HackerNews/API">HN
API</a>.</p>
<h2>{{ time }}</h2>
<h2>Who</h2>
<p><a href="mailto:sneak@sneak.berlin">@sneak</a>.</p>
</div>
{% endblock %}