mirror of
https://github.com/Eggbertx/gochan.git
synced 2025-08-01 22:26:24 -07:00
Update Docker files to use build.py instead of the no longer existing Makefile
Also don't try to read version file when getting dependencies
This commit is contained in:
parent
83d098aa68
commit
5a2018e4d1
3 changed files with 14 additions and 12 deletions
14
build.py
14
build.py
|
@ -1,6 +1,7 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
# This build script will eventually replace both the Makefile and build.ps1
|
||||
# This script replaces both the Makefile and build.ps1
|
||||
# to provide a simple cross-platform build tool
|
||||
|
||||
import argparse
|
||||
import os
|
||||
|
@ -11,7 +12,7 @@ import sys
|
|||
import tarfile
|
||||
from zipfile import ZipFile
|
||||
|
||||
gc_dependencies = [
|
||||
gc_dependencies = (
|
||||
"github.com/disintegration/imaging",
|
||||
"github.com/nranchev/go-libGeoIP",
|
||||
"github.com/go-sql-driver/mysql",
|
||||
|
@ -22,9 +23,9 @@ gc_dependencies = [
|
|||
"github.com/frustra/bbcode",
|
||||
"github.com/tdewolff/minify",
|
||||
"github.com/mojocn/base64Captcha"
|
||||
]
|
||||
)
|
||||
|
||||
release_files = [
|
||||
release_files = (
|
||||
"html/banned.jpg",
|
||||
"html/css",
|
||||
"html/error",
|
||||
|
@ -45,7 +46,7 @@ release_files = [
|
|||
"initdb_postgres.sql",
|
||||
"LICENSE",
|
||||
"README.md",
|
||||
]
|
||||
)
|
||||
|
||||
def fs_action(action, sourcefile, destfile = ""):
|
||||
isfile = path.isfile(sourcefile) or path.islink(sourcefile)
|
||||
|
@ -281,7 +282,8 @@ if __name__ == "__main__":
|
|||
pass
|
||||
if(action.startswith("-") == False):
|
||||
sys.argv.insert(1, action)
|
||||
set_vars()
|
||||
if(action != "dependencies"):
|
||||
set_vars()
|
||||
|
||||
valid_actions = ["build", "clean", "dependencies", "docker", "install", "js", "release", "sass", "test"]
|
||||
parser = argparse.ArgumentParser(description = "gochan build script")
|
||||
|
|
|
@ -5,11 +5,11 @@ RUN apk --no-cache add \
|
|||
mariadb-client \
|
||||
nginx \
|
||||
ffmpeg \
|
||||
make \
|
||||
python3 \
|
||||
git \
|
||||
gcc \
|
||||
musl-dev \
|
||||
bash
|
||||
bash
|
||||
|
||||
RUN mkdir -p /root/bin \
|
||||
&& ln -s /usr/lib/go-1.13/bin/* /root/bin/ \
|
||||
|
@ -23,8 +23,8 @@ RUN mkdir -p /root/bin \
|
|||
WORKDIR /opt/gochan
|
||||
|
||||
# Get dependencies
|
||||
COPY Makefile .
|
||||
RUN make dependencies
|
||||
COPY build.py .
|
||||
RUN ./build.py dependencies
|
||||
|
||||
RUN rm /etc/nginx/conf.d/default.conf
|
||||
COPY sample-configs/gochan-fastcgi.nginx /etc/nginx/conf.d/gochan.conf
|
||||
|
|
|
@ -6,10 +6,10 @@ If you want docker to manage the databse, use `docker-compose-[database].yml`.
|
|||
|
||||
If you are using MacOS and need better file sync between the host and the container, use `docker-compose-syncForMac.yml`.
|
||||
|
||||
To use from the root gochan directory, run `make docker`, or `make docker-macos` if you are using MacOS. This will use the MariaDB docker-compose file. If you want to specify which docker-compose file to use, run `docker-compose -f [docker-compose.yml file you chose] up --build` from this directory. To stop, simply use control+c to send a stop signal. This stops the docker containers but it does not delete them. They are merely frozen.
|
||||
To use from the root gochan directory, run `./build.py docker`, or `./build.py docker ---option macos` if you are using MacOS. This will use the MariaDB docker-compose file. If you want to specify which docker-compose file to use, run `docker-compose -f [docker-compose.yml file you chose] up --build` from this directory. To stop, simply use control+c to send a stop signal. This stops the docker containers but it does not delete them. They are merely frozen.
|
||||
|
||||
To delete the containers run `docker-compose -f [file you chose] down`. If you have a container that has a database (for example, if you chose `docker-compose-mariadb.yml`), this command will delete the database too.
|
||||
|
||||
If you want to use a specific docker-compose file as the default for your own computer, or you want to edit one of the default configurations given here (to change the database type, for example), copy the file and name it `docker-compose.yml`. This way, you can omit specifying the file when using docker-compose. For example, `docker-compose down` is the same as `docker-compose -f docker-compose.yml down`. The file is added to .gitignore so that your local config won't be accidentally commited.
|
||||
|
||||
Docker caches builds. When files change, it has to rebuild from whenever that file was added to the docker image. For example, the docker file adds `Makefile` at first and ignores the rest of the files. It uses it to download the dependencies, which can take a while. After that, it adds the rest of the files. This means that if a file is changed in a source file, docker won't have to rebuild. But if the Makefile changes, it will be forced to rebuild. This can cause Docker to bloat up after a while. Periodically remember to run `docker image prune` (also search for other deletion commands) to keep docker's storage usage relatively low. All images used thus far use Alpine, which is a small OS compared to Ubuntu or other much larger builds.
|
||||
Docker caches builds. When files change, it has to rebuild from whenever that file was added to the docker image. For example, the docker file adds `build.py` at first and ignores the rest of the files. It uses it to download the dependencies, which can take a while. After that, it adds the rest of the files. This means that if a file is changed in a source file, docker won't have to rebuild. But if build.py changes, it will be forced to rebuild. This can cause Docker to bloat up after a while. Periodically remember to run `docker image prune` (also search for other deletion commands) to keep docker's storage usage relatively low. All images used thus far use Alpine, which is a small OS compared to Ubuntu or other much larger builds.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue