diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..0691627 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,16 @@ +# Remove project files, data, tmp files, build files +/.env +/.idea +/data +/node_modules +/tmp + +/.dockerignore +/.gitignore +/build-*.sh +/Dockerfile +/*.iml +/package*.json + +# Remove development settings +/siteroot/settings/dev.py diff --git a/Dockerfile b/Dockerfile index 939e0ba..86e89ca 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,25 +5,17 @@ RUN apt-get update RUN apt-get -y install build-essential # Install requirements and uwsgi server for running python web apps -WORKDIR /etc/linkdings +WORKDIR /etc/linkding COPY requirements.prod.txt ./requirements.txt RUN pip install -U pip RUN pip install -Ur requirements.txt -RUN pip install uwsgi # Copy application -COPY bookmarks ./bookmarks -COPY siteroot ./siteroot -COPY static ./static -COPY manage.py . -COPY uwsgi.ini . -COPY bootstrap.sh . -RUN ["chmod", "+x", "./bootstrap.sh"] - -# Create data folder -RUN ["mkdir", "data"] +COPY . . +# Expose uwsgi server at port 9090 EXPOSE 9090 -# Start uwsgi server +# Run bootstrap logic +RUN ["chmod", "+x", "./bootstrap.sh"] CMD ["./bootstrap.sh"] diff --git a/bootstrap.sh b/bootstrap.sh index 450a108..80bc7d0 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -1,14 +1,12 @@ #!/usr/bin/env bash # Bootstrap script that gets executed in new Docker containers -# Set host name in settings if it was passed as environment variable -if [[ -v HOST_NAME ]] -then - printf "ALLOWED_HOSTS=['%s']" $HOST_NAME > ./siteroot/settings_custom.py -fi - +# Create data folder if it does not exist +mkdir -p data # Run database migration python manage.py migrate +# Generate secret key file if it does not exist +python manage.py generate_secret_key # Start uwsgi server uwsgi uwsgi.ini diff --git a/build-docker.sh b/build-docker.sh index 1c51aab..0813d47 100755 --- a/build-docker.sh +++ b/build-docker.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash ./build-static.sh -docker build -t sissbruecker/linkding . -#docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t sissbruecker/linkding:latest --push . +#docker build -t sissbruecker/linkding . +docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t sissbruecker/linkding:latest --push . diff --git a/linkdings.iml b/linkdings.iml index 613ffc2..afe2abf 100644 --- a/linkdings.iml +++ b/linkdings.iml @@ -4,7 +4,7 @@