Skip to content

Commit

Permalink
File locations has been rearranged (Close #1)
Browse files Browse the repository at this point in the history
  • Loading branch information
nobrin committed Feb 14, 2017
1 parent b7ee048 commit c3750a8
Show file tree
Hide file tree
Showing 20 changed files with 28 additions and 15 deletions.
8 changes: 7 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
Dockerfile
code
.dockerignore
.git/
!.git/HEAD
!.git/refs
.gitignore
pkgs/
code/
lib/bottle.py
*/*.pyc
README.md
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
code/
pkgs/

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand Down
17 changes: 9 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,19 @@ MAINTAINER Nobuo OKAZAKI
RUN apk add --no-cache python2 py2-bottle bash \
&& adduser -u 1000 -D bottle bottle \
&& rm -rf /tmp/* /media /mnt /run /srv
ADD ./ /opt/regiui/
ADD .git/HEAD /tmp/.git/
ADD .git/refs /tmp/.git/refs
RUN GITREF=$(cat /tmp/.git/HEAD | cut -d" " -f2) \
&& GITSHA1=$(cat /tmp/.git/$GITREF) \
ENV INSTALL_PREFIX /opt/regiui
COPY ./ $INSTALL_PREFIX
RUN set -x \
&& GITREF=$(cat $INSTALL_PREFIX/.git/HEAD | cut -d" " -f2) \
&& GITSHA1=$(cat $INSTALL_PREFIX/.git/$GITREF) \
&& GITBR=$(echo refs/heads/master | cut -d/ -f3) \
&& echo "{\"git\":{\"sha1\":\"$GITSHA1\",\"branch\":\"$GITBR\"}}" > /opt/regiui/public/version.json \
&& echo "{\"git\":{\"sha1\":\"$GITSHA1\",\"branch\":\"$GITBR\"}}" > $INSTALL_PREFIX/share/regiui/static/version.json \
&& rm -rf $INSTALL_PREFIX/.git \
&& rm -rf /tmp/* /media /mnt /run /srv
ENV PYTHONPATH /opt/regiui/lib:$PYTHONPATH
ENV PYTHONPATH $INSTALL_PREFIX/lib
USER bottle
ENTRYPOINT ["bottle.py", \
"-b", "0.0.0.0:8000", \
"regiui" \
"regiui.app" \
]
EXPOSE 8000
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ RegiUI requires python 2.7 and [bottle.py](https://bottlepy.org). You have to in
```
$ sudo yum -y install python2-bottle
$ export PYTHONPATH=<path to lib of RegiUI>:$PYTHONPATH
$ python /usr/lib/python2.7/site-packages/bottle.py regiui
$ python /usr/lib/python2.7/site-packages/bottle.py regiui.app
Bottle v0.12.9 server starting up (using WSGIRefServer())...
Listening on http://localhost:8080/
Hit Ctrl-C to quit.
Expand Down
File renamed without changes.
11 changes: 7 additions & 4 deletions lib/regiui.py → lib/regiui/app.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
# -*- coding: utf-8 -*-
# Project:
# Module:
import sys, os
import sys, os, re
import bottle
from bottle import route, static_file, redirect, request, HTTPError
from docker_registry import Registry
from . import Registry

bottle.TEMPLATE_PATH = [os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "templates"))]
STATIC_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "public"))
LIB_PATH = re.sub(r"/python%d\.%d/site-packages/regiui$", "/regiui", os.path.abspath(os.path.dirname(__file__)))
SHARE_PATH = os.path.abspath(os.path.join(LIB_PATH, "..", "..", "share", "regiui"))
STATIC_PATH = os.path.join(SHARE_PATH, "static")
bottle.TEMPLATE_PATH = [os.path.join(SHARE_PATH, "views")]
print SHARE_PATH

PREFIX = os.environ.get("URL_PREFIX", "/").rstrip("/") + "/"
REGISTRY = os.environ.get("REGISTRY", "http://localhost:5000")
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ <h4 class="modal-title">Are you sure?</h4>
<div class="modal-body">
<p class="text-danger"><strong>This function is EXPERIMENTAL and DANGEROUS. Do your own risk!!</strong></p>
<p>This action CANNOT be undone. This will permanently delete the <b>{{ reponame }}:{{ info["name"] }}</b> tag from {{ reponame }} repository.</p>
<p>Please type in the name of the tag to confirm.</p>
<p>Please type in the name of the tag '<b>{{ info["name"] }}</b>' to confirm.</p>
<input type="text" class="form-control" id="txtDelete">
</div>
<div class="modal-footer">
Expand Down

0 comments on commit c3750a8

Please sign in to comment.