Spaces:
Sleeping
Sleeping
Nicky Nicolson
commited on
Commit
•
fab3ed6
1
Parent(s):
7822dce
Strip test secret, unzip artifact
Browse files- Dockerfile +4 -6
- downloadartifact.py +0 -7
Dockerfile
CHANGED
@@ -21,13 +21,11 @@ WORKDIR /code
|
|
21 |
COPY ./requirements.txt /code/requirements.txt
|
22 |
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
23 |
|
24 |
-
RUN --mount=type=secret,id=GREETING,mode=0444,required=true cat /run/secrets/GREETING
|
25 |
-
|
26 |
COPY ./downloadartifact.py /code
|
27 |
-
RUN --mount=type=secret,id=GH_TOKEN,mode=0444,required=true ls -ltrah /run/secrets/GH_TOKEN
|
28 |
RUN --mount=type=secret,id=GH_TOKEN,mode=0444,required=true \
|
29 |
-
|
30 |
-
|
|
|
31 |
RUN ls -l /code
|
32 |
|
33 |
# Download ID is set as a space variable
|
@@ -35,7 +33,7 @@ RUN ls -l /code
|
|
35 |
|
36 |
|
37 |
# Get ihdelta sqlite db
|
38 |
-
ADD https://drive.google.com/uc?export=download&id=1on1yWtPihmWSmuMqmEl1blV2fQVtxI62 /code/ihdelta.db
|
39 |
RUN sqlite-utils tables /code/ihdelta.db --counts
|
40 |
RUN chmod 755 /code/ihdelta.db
|
41 |
|
|
|
21 |
COPY ./requirements.txt /code/requirements.txt
|
22 |
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
23 |
|
|
|
|
|
24 |
COPY ./downloadartifact.py /code
|
|
|
25 |
RUN --mount=type=secret,id=GH_TOKEN,mode=0444,required=true \
|
26 |
+
python /code/downloadartifact.py ${IHDELTA_DB_ARTIFACT_URL} /run/secrets/GH_TOKEN /code/ihdelta.db.zip
|
27 |
+
RUN ls -l /code
|
28 |
+
RUN unzip /code/ihdelta.db.zip -d /code
|
29 |
RUN ls -l /code
|
30 |
|
31 |
# Download ID is set as a space variable
|
|
|
33 |
|
34 |
|
35 |
# Get ihdelta sqlite db
|
36 |
+
# ADD https://drive.google.com/uc?export=download&id=1on1yWtPihmWSmuMqmEl1blV2fQVtxI62 /code/ihdelta.db
|
37 |
RUN sqlite-utils tables /code/ihdelta.db --counts
|
38 |
RUN chmod 755 /code/ihdelta.db
|
39 |
|
downloadartifact.py
CHANGED
@@ -12,8 +12,6 @@ def getArtifact(artifactUrl, gh_tokenfile, outputfile):
|
|
12 |
gh_token = None
|
13 |
with open(gh_tokenfile, 'r') as f:
|
14 |
gh_token = f.read()
|
15 |
-
print('Read token of length {}'.format(len(gh_token)))
|
16 |
-
# headers = {'Authorization': 'Bearer: {}'.format(gh_token)}
|
17 |
headers = {'Authorization': f'token {gh_token}'}
|
18 |
r = requests.get(artifactUrl, headers=headers)
|
19 |
if r.status_code == 200:
|
@@ -24,16 +22,11 @@ def getArtifact(artifactUrl, gh_tokenfile, outputfile):
|
|
24 |
|
25 |
def main():
|
26 |
parser = argparse.ArgumentParser(description='Download artifact from github')
|
27 |
-
parser.add_argument('greetingfile', help='a test secret')
|
28 |
parser.add_argument('url', help='url for the artifact building run')
|
29 |
parser.add_argument('gh_tokenfile', help='authentication token')
|
30 |
parser.add_argument('outputfile', help='where to store downloaded file')
|
31 |
|
32 |
args = parser.parse_args()
|
33 |
-
print(args.greetingfile)
|
34 |
-
with open(args.greetingfile, 'r') as f:
|
35 |
-
greeting = f.read()
|
36 |
-
print('Read greeting secret: {}'.format(greeting))
|
37 |
|
38 |
artifact_url = getArtifactUrl(args.url)
|
39 |
print(artifact_url)
|
|
|
12 |
gh_token = None
|
13 |
with open(gh_tokenfile, 'r') as f:
|
14 |
gh_token = f.read()
|
|
|
|
|
15 |
headers = {'Authorization': f'token {gh_token}'}
|
16 |
r = requests.get(artifactUrl, headers=headers)
|
17 |
if r.status_code == 200:
|
|
|
22 |
|
23 |
def main():
|
24 |
parser = argparse.ArgumentParser(description='Download artifact from github')
|
|
|
25 |
parser.add_argument('url', help='url for the artifact building run')
|
26 |
parser.add_argument('gh_tokenfile', help='authentication token')
|
27 |
parser.add_argument('outputfile', help='where to store downloaded file')
|
28 |
|
29 |
args = parser.parse_args()
|
|
|
|
|
|
|
|
|
30 |
|
31 |
artifact_url = getArtifactUrl(args.url)
|
32 |
print(artifact_url)
|