mirror of
https://github.com/unmojang/meta.git
synced 2025-09-23 03:01:21 -04:00
refactor: improve usage with Docker
This commit is contained in:
parent
dc6dc8c496
commit
6bbecdce2a
8
.dockerignore
Normal file
8
.dockerignore
Normal file
@ -0,0 +1,8 @@
|
||||
.git/
|
||||
|
||||
caches/
|
||||
__pycache__/
|
||||
public/
|
||||
|
||||
polymc/
|
||||
upstream/
|
10
.gitignore
vendored
10
.gitignore
vendored
@ -1,10 +1,8 @@
|
||||
public/*/
|
||||
|
||||
http_cache
|
||||
caches/
|
||||
!caches/*/.keep
|
||||
__pycache__
|
||||
config_local.sh
|
||||
polymc
|
||||
upstream
|
||||
forgemaven
|
||||
forge_cache
|
||||
__pycache__
|
||||
*.kdev4
|
||||
config_local.sh
|
||||
|
@ -1,12 +1,14 @@
|
||||
FROM python:3.10.2-bullseye
|
||||
|
||||
RUN pip install cachecontrol iso8601 requests lockfile jsonobject
|
||||
|
||||
RUN apt update && apt install -y rsync
|
||||
RUN pip install cachecontrol iso8601 requests lockfile jsonobject \
|
||||
&& apt-get update && apt-get install -y rsync
|
||||
|
||||
RUN useradd -Ud /app user
|
||||
|
||||
USER user
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY . .
|
||||
|
||||
ENV MODE=master
|
||||
|
||||
CMD ["/bin/bash", "update.sh"]
|
0
caches/forge_cache/.keep
Normal file
0
caches/forge_cache/.keep
Normal file
0
caches/forgemaven/.keep
Normal file
0
caches/forgemaven/.keep
Normal file
0
caches/http_cache/.keep
Normal file
0
caches/http_cache/.keep
Normal file
12
docker-compose.yaml
Normal file
12
docker-compose.yaml
Normal file
@ -0,0 +1,12 @@
|
||||
version: "3"
|
||||
|
||||
services:
|
||||
meta:
|
||||
build: .
|
||||
environment:
|
||||
MODE: master
|
||||
volumes:
|
||||
- "./caches:/app/caches"
|
||||
- "./upstream:/app/upstream"
|
||||
- "./polymc:/app/polymc"
|
||||
- "./public:/app/public"
|
@ -1,5 +0,0 @@
|
||||
#!/bin/bash
|
||||
docker build metaenv -t metaenv
|
||||
|
||||
docker run -it --rm -e MODE=master -v $(pwd):/app metaenv:latest ./update.sh
|
||||
|
@ -109,13 +109,13 @@ for entry in forgeVersions.versions:
|
||||
for entry in forgeVersion.mavenFiles:
|
||||
urlSet.add(GetLibraryDownload(entry))
|
||||
|
||||
forever_cache = FileCache('forge_cache', forever=True)
|
||||
forever_cache = FileCache('caches/forge_cache', forever=True)
|
||||
sess = CacheControl(requests.Session(), forever_cache)
|
||||
|
||||
for entry in urlSet:
|
||||
libraryName = entry.name
|
||||
folderPath = "forgemaven/%s" % libraryName.getBase()
|
||||
filePath = "forgemaven/%s" % libraryName.getPath()
|
||||
folderPath = "caches/forgemaven/%s" % libraryName.getBase()
|
||||
filePath = "caches/forgemaven/%s" % libraryName.getPath()
|
||||
if not os.path.isfile(filePath):
|
||||
os.makedirs(folderPath, exist_ok=True)
|
||||
rfile = sess.get(entry.url, stream=True)
|
||||
|
@ -11,7 +11,7 @@ from fabricutil import *
|
||||
|
||||
UPSTREAM_DIR = os.environ["UPSTREAM_DIR"]
|
||||
|
||||
forever_cache = FileCache('http_cache', forever=True)
|
||||
forever_cache = FileCache('caches/http_cache', forever=True)
|
||||
sess = CacheControl(requests.Session(), forever_cache)
|
||||
|
||||
def mkdirs(path):
|
||||
|
@ -32,7 +32,7 @@ def filehash(filename, hashtype, blocksize=65536):
|
||||
hash.update(block)
|
||||
return hash.hexdigest()
|
||||
|
||||
forever_cache = FileCache('http_cache', forever=True)
|
||||
forever_cache = FileCache('caches/http_cache', forever=True)
|
||||
sess = CacheControl(requests.Session(), forever_cache)
|
||||
|
||||
# get the remote version list fragments
|
||||
|
@ -18,7 +18,7 @@ UPSTREAM_DIR = os.environ["UPSTREAM_DIR"]
|
||||
def eprint(*args, **kwargs):
|
||||
print(*args, file=sys.stderr, **kwargs)
|
||||
|
||||
forever_cache = FileCache('http_cache', forever=True)
|
||||
forever_cache = FileCache('caches/http_cache', forever=True)
|
||||
sess = CacheControl(requests.Session(), forever_cache)
|
||||
|
||||
|
||||
|
@ -8,7 +8,7 @@ from metautil import *
|
||||
|
||||
UPSTREAM_DIR = os.environ["UPSTREAM_DIR"]
|
||||
|
||||
forever_cache = FileCache('http_cache', forever=True)
|
||||
forever_cache = FileCache('caches/http_cache', forever=True)
|
||||
sess = CacheControl(requests.Session(), forever_cache)
|
||||
|
||||
def get_version_file(path, url):
|
||||
|
Loading…
x
Reference in New Issue
Block a user