From 07e3cf793fefb25c82191b6a5f9c4430f26e3530 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Deuchnord?= Date: Sun, 16 May 2021 11:11:42 +0200 Subject: [PATCH] build: fix Docker image build --- .github/workflows/dockerfile.yml | 26 ++++++++++++++++++++++++++ Dockerfile | 23 +++++++++++++++-------- setup.cfg | 6 +++--- 3 files changed, 44 insertions(+), 11 deletions(-) create mode 100644 .github/workflows/dockerfile.yml diff --git a/.github/workflows/dockerfile.yml b/.github/workflows/dockerfile.yml new file mode 100644 index 0000000..32d6d30 --- /dev/null +++ b/.github/workflows/dockerfile.yml @@ -0,0 +1,26 @@ +name: Docker image + +on: + push: + branches: [master, features] + pull_request: + branches: [master, features] + +jobs: + build-image: + runs-on: ubuntu-latest + + name: Test building Docker image + steps: + - uses: actions/checkout@v1 + + - name: Set up Docker + uses: docker-practice/actions-setup-docker@v1 + + - name: Create image + run: | + docker build -t kosmorro . + + - name: Execute image + run: | + docker run kosmorro kosmorro diff --git a/Dockerfile b/Dockerfile index 3f8450a..49557aa 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,22 +6,29 @@ WORKDIR /home/kosmorro ENV PATH="/home/kosmorro:${PATH}" +# Prepare environment RUN python -m pip install --upgrade pip - RUN pip install pipenv - COPY Pipfile.lock . - RUN pipenv sync && pipenv run pip freeze > requirements.txt -RUN pip uninstall pipenv -y - +# Add files RUN pip install -r requirements.txt - -COPY kosmorrolib/ kosmorrolib/ - +COPY _kosmorro/ _kosmorro/ COPY kosmorro . +# Compile the translations +RUN pip install Babel +COPY setup.py setup.py +COPY setup.cfg setup.cfg +COPY README.md README.md +RUN python setup.py compile_catalog + +# Clean the image +RUN rm setup.py setup.cfg README.md && \ + rm _kosmorro/locales/messages.pot _kosmorro/locales/*/LC_MESSAGES/messages.po && \ + pip uninstall --yes Babel pipenv + USER kosmorro CMD ["bash"] diff --git a/setup.cfg b/setup.cfg index 6c447bf..089fb4b 100644 --- a/setup.cfg +++ b/setup.cfg @@ -2,11 +2,11 @@ charset = utf-8 keywords = _ ngettext width = 120 -output_file = kosmorrolib/locales/messages.pot +output_file = _kosmorro/locales/messages.pot omit_header = true copyright_holder = Jérôme Deuchnord -input_paths=kosmorro,kosmorrolib +input_paths=kosmorro,_kosmorro [compile_catalog] domain = messages -directory = kosmorrolib/locales +directory = _kosmorro/locales