dockerfile

This commit is contained in:
dni ⚡ 2024-08-30 13:58:36 +02:00
parent f056f59281
commit 53082b9d75
No known key found for this signature in database
GPG Key ID: D1F416F29AD26E87
2 changed files with 25 additions and 18 deletions

View File

@ -13,22 +13,27 @@ ENV PATH="/root/.local/bin:$PATH"
WORKDIR /app
# Only copy the files required to install the dependencies
COPY pyproject.toml poetry.lock ./
COPY Makefile package.json package-lock.json pyproject.toml poetry.lock ./
RUN mkdir data
ENV POETRY_NO_INTERACTION=1 \
POETRY_VIRTUALENVS_IN_PROJECT=1 \
POETRY_VIRTUALENVS_CREATE=1 \
POETRY_CACHE_DIR=/tmp/poetry_cache
RUN poetry install --only main
# bundle files
RUN mkdir -p lnbits/static/css lnbits/static/vendor
COPY lnbits/static/scss/ ./lnbits/static/scss/
COPY lnbits/static/js/ ./lnbits/static/js/
COPY lnbits/static/i18n/ ./lnbits/static/i18n/
RUN make build
FROM python:3.10-slim-bookworm
# needed for backups postgresql-client version 14 (pg_dump)
RUN apt-get update && apt-get -y upgrade && \
apt-get -y install gnupg2 curl lsb-release && \
apt-get -y install gnupg2 curl lsb-release libnss-myhostname && \
sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list' && \
curl -s https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - && \
apt-get update && \
@ -49,9 +54,8 @@ WORKDIR /app
COPY . .
COPY --from=builder /app/.venv .venv
RUN make
RUN make build
COPY --from=builder /app/lnbits/static/bundle.min.js lnbits/static
COPY --from=builder /app/lnbits/static/bundle.min.css lnbits/static
RUN mkdir data

View File

@ -6,6 +6,20 @@ check: mypy pyright checkblack checkruff checkprettier checkbundle
test: test-unit test-wallets test-api test-regtest
install:
poetry install --only main
bundle:
npm install
npm run sass
npm run vendor_copy
npm run vendor_json
poetry run ./node_modules/.bin/prettier -w ./lnbits/static/vendor.json
npm run vendor_bundle_css
npm run vendor_minify_css
npm run vendor_bundle_js
npm run vendor_minify_js
prettier:
poetry run ./node_modules/.bin/prettier --write .
@ -99,17 +113,6 @@ bak:
sass:
npm run sass
bundle:
npm install
npm run sass
npm run vendor_copy
npm run vendor_json
poetry run ./node_modules/.bin/prettier -w ./lnbits/static/vendor.json
npm run vendor_bundle_css
npm run vendor_minify_css
npm run vendor_bundle_js
npm run vendor_minify_js
install-pre-commit-hook:
@echo "Installing pre-commit hook to git"
@echo "Uninstall the hook with poetry run pre-commit uninstall"