0

I'm new to Docker, so I am not sure how to interpret the cause of errors.

What is causing lines 5 to 7 to crash? How do I remedy this specific error, in my case?

Ask Ubunutu post


ls:

me@LAPTOP-G1DAPU88:~/.ssh/workers-python/workers/ontology_tagger$ ls
Dockerfile  README.md  azure-pipeline-ontology_tagger.yaml  ontology_tagger  poetry.lock  pyproject.toml  pytest.ini  wss-unified-agent.config  wss_agent.sh

1st Attempt

Note: --no-cache didn't help.

Terminal (Command, Output & Error):

me@LAPTOP-G1DAPU88:~/.ssh/workers-python/workers/ontology_tagger$ docker build -t my_app -f /home/me/.ssh/workers-python/workers/ontology_tagger/Dockerfile .
[+] Building 24.1s (8/23)                                                                                                                                                                                  
 => [internal] load build definition from Dockerfile                                                                                                                                                  0.0s
 => => transferring dockerfile: 38B                                                                                                                                                                   0.0s
 => [internal] load .dockerignore                                                                                                                                                                     0.0s
 => => transferring context: 2B                                                                                                                                                                       0.0s
 => [internal] load metadata for docker.io/library/python:3.7-slim                                                                                                                                    3.3s
 => [auth] library/python:pull token for registry-1.docker.io                                                                                                                                         0.0s
 => CACHED [production 1/5] FROM docker.io/library/python:3.7-slim@sha256:798c7c77f4bba96b35de5fe9832b81084dcc4c1c52806d7976bf9233c7c3c4a6                                                            0.0s
 => [internal] load build context                                                                                                                                                                     0.0s
 => => transferring context: 2.10kB                                                                                                                                                                   0.0s
 => CACHED https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py                                                                                                                0.0s
 => ERROR [base 2/7] RUN apt-get update -y     && apt-get -y --no-install-recommends install curl wget    && rm -rf /var/lib/apt/lists/*                                                             20.7s
------                                                                                                                                                                                                     
 > [base 2/7] RUN apt-get update -y     && apt-get -y --no-install-recommends install curl wget    && rm -rf /var/lib/apt/lists/*:                                                                         
#6 0.547 Get:1 http://security.debian.org/debian-security bullseye-security InRelease [44.1 kB]                                                                                                            
#6 0.570 Get:2 http://deb.debian.org/debian bullseye InRelease [113 kB]                                                                                                                                    
#6 0.909 Get:3 http://deb.debian.org/debian bullseye-updates InRelease [36.8 kB]                                                                                                                           
#6 1.019 Get:4 http://deb.debian.org/debian bullseye/main amd64 Packages [8178 kB]
#6 20.17 Reading package lists...
#6 20.67 E: Release file for http://security.debian.org/debian-security/dists/bullseye-security/InRelease is not valid yet (invalid for another 1d 10h 41min 46s). Updates for this repository will not be applied.
#6 20.67 E: Release file for http://deb.debian.org/debian/dists/bullseye-updates/InRelease is not valid yet (invalid for another 1d 20h 22min 49s). Updates for this repository will not be applied.
------
executor failed running [/bin/sh -c apt-get update -y     && apt-get -y --no-install-recommends install curl wget    && rm -rf /var/lib/apt/lists/*]: exit code: 100

2nd Attempt

I reset the local Docker clock/ time:

sudo date -s "$(wget -qSO- --max-redirect=0 google.com 2>&1 | grep Date: | cut -d' ' -f5-8)Z"
sudo apt update
me@LAPTOP-G1DAPU88:~/.ssh/workers-python/workers/ontology_tagger$ docker build --no-cache -t my_app -f /home/me/.ssh/workers-python/workers/ontology_tagger/Dockerfile .
[+] Building 1126.9s (16/23)                                                                                                                                                                               
 => [internal] load build definition from Dockerfile                                                                                                                                                  0.0s
 => => transferring dockerfile: 38B                                                                                                                                                                   0.0s
 => [internal] load .dockerignore                                                                                                                                                                     0.1s
 => => transferring context: 2B                                                                                                                                                                       0.0s
 => [internal] load metadata for docker.io/library/python:3.7-slim                                                                                                                                    6.8s
 => [auth] library/python:pull token for registry-1.docker.io                                                                                                                                         0.0s
 => CACHED https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py                                                                                                                0.0s
 => [internal] load build context                                                                                                                                                                     0.1s
 => => transferring context: 2.10kB                                                                                                                                                                   0.0s
 => CACHED [base 1/7] FROM docker.io/library/python:3.7-slim@sha256:798c7c77f4bba96b35de5fe9832b81084dcc4c1c52806d7976bf9233c7c3c4a6                                                                  0.0s
 => [base 2/7] RUN apt-get update -y     && apt-get -y --no-install-recommends install curl wget    && rm -rf /var/lib/apt/lists/*                                                                   15.0s
 => [base 3/7] WORKDIR /home/worker/python/ontology_tagger                                                                                                                                            0.1s
 => [base 4/7] ADD https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py ./                                                                                                     0.1s
 => [base 5/7] RUN python get-poetry.py && chmod +x /etc/poetry/bin/poetry                                                                                                                           22.8s
 => [base 6/7] RUN --mount=type=cache,target=/root/.cache pip install twine keyring artifacts-keyring                                                                                                45.2s
 => [base 7/7] RUN --mount=type=cache,target=/root/.cache apt update && apt install gcc -y                                                                                                           74.6s
 => [build 1/6] COPY . .                                                                                                                                                                              0.1s
 => [build 2/6] RUN poetry config experimental.new-installer false                                                                                                                                    4.0s 
 => ERROR [build 3/6] RUN poetry install --no-dev                                                                                                                                                   957.8s 
------                                                                                                                                                                                                     
 > [build 3/6] RUN poetry install --no-dev:                                                                                                                                                                
#16 2.875 Creating virtualenv ontology-tagger in /home/worker/python/ontology_tagger/.venv                                                                                                                 
#16 10.67 Installing dependencies from lock file                                                                                                                                                           
#16 20.08                                                                                                                                                                                                  
#16 20.08 Package operations: 199 installs, 0 updates, 1 removal                                                                                                                                           
#16 20.08 
#16 20.08   - Removing wheel (0.37.0)
#16 22.17   - Installing six (1.16.0)
#16 24.30   - Installing typing-extensions (3.10.0.0)
#16 25.71   - Installing zipp (3.5.0)
#16 27.16   - Installing certifi (2021.5.30)
#16 28.62   - Installing charset-normalizer (2.0.4)
#16 29.87   - Installing greenlet (1.1.1)
#16 32.66   - Installing idna (3.2)
#16 34.46   - Installing importlib-metadata (4.6.3)
#16 36.39   - Installing ipython-genutils (0.2.0)
#16 38.22   - Installing markupsafe (2.0.1)
#16 40.31   - Installing promise (2.3)
#16 44.02   - Installing pyasn1 (0.4.8)
#16 46.20   - Installing pycparser (2.20)
#16 47.54   - Installing pytz (2021.1)
#16 50.69   - Installing rx (1.6.1)
#16 53.73   - Installing urllib3 (1.26.6)
#16 55.51   - Installing attrs (21.2.0)
#16 57.61   - Installing cachetools (4.2.2)
#16 59.42   - Installing cffi (1.14.6)
#16 61.78   - Installing graphql-core (2.3.2)
#16 64.82   - Installing grpcio (1.39.0)
#16 71.48   - Installing heapdict (1.0.1)
#16 73.48   - Installing humanfriendly (9.2)
#16 75.81   - Installing jmespath (0.10.0)
#16 77.71   - Installing locket (0.2.1)
#16 79.41   - Installing mako (1.1.4)
#16 81.67   - Installing numpy (1.21.1)
#16 93.17   - Installing oauthlib (3.1.1)
#16 95.73   - Installing protobuf (3.17.3)
#16 99.28   - Installing pyasn1-modules (0.2.8)
#16 101.7   - Installing pyparsing (2.4.7)
#16 103.6   - Installing pyrsistent (0.18.0)
#16 105.7   - Installing python-dateutil (2.8.2)
#16 108.0   - Installing python-editor (1.0.4)
#16 110.5   - Installing pytzdata (2020.1)
#16 114.0   - Installing pyyaml (5.3.1)
#16 118.6   - Installing requests (2.26.0)
#16 120.0   - Installing rsa (4.7.2)
#16 122.0   - Installing sqlalchemy (1.4.22)
#16 127.7   - Installing toolz (0.11.1)
#16 129.9   - Installing traitlets (5.0.5)
#16 132.6   - Installing tzlocal (1.5.1)
#16 135.9   - Installing zope.event (4.5.0)
#16 137.9   - Installing zope.interface (5.4.0)
#16 141.0   - Installing alembic (1.4.1)
#16 145.7   - Installing aniso8601 (7.0.0)
#16 148.1   - Installing backports.entry-points-selectable (1.1.0)
#16 150.0   - Installing botocore (1.21.19)
#16 158.1   - Installing click (7.1.2)
#16 160.7   - Installing cloudpickle (1.6.0)
#16 163.0   - Installing coloredlogs (14.0)
#16 165.3   - Installing contextlib2 (21.6.0)
#16 167.2   - Installing croniter (1.0.15)
#16 169.5   - Installing dask (2.30.0)
#16 174.4   - Installing dill (0.3.4)
#16 176.9   - Installing distlib (0.3.2)
#16 179.3   - Installing docstring-parser (0.7.1)
#16 188.8   - Installing filelock (3.0.12)
#16 190.8   - Installing fsspec (2021.7.0)
#16 193.6   - Installing funcsigs (1.0.2)
#16 195.5   - Installing future (0.18.2)
#16 201.4   - Installing gevent (21.8.0)
#16 207.3   - Installing google-auth (1.34.0)
#16 209.7   - Installing graphql-relay (2.0.1)
#16 212.0   - Installing grpcio-health-checking (1.39.0)
#16 214.1   - Installing itsdangerous (1.1.0)
#16 216.1   - Installing jinja2 (2.11.3)
#16 218.5   - Installing jsonschema (3.2.0)
#16 221.0   - Installing jupyter-core (4.7.1)
#16 223.4   - Installing marshmallow (3.13.0)
#16 225.7   - Installing msgpack (1.0.2)
#16 228.3   - Installing multidict (5.1.0)
#16 232.2   - Installing mypy-extensions (0.4.3)
#16 234.1   - Installing packaging (20.9)
#16 236.7   - Installing pandas (1.1.4)
#16 251.7   - Installing partd (1.2.0)
#16 253.5   - Installing pendulum (1.4.4)
#16 261.3   - Installing pillow (8.3.1)
#16 271.3   - Installing platformdirs (2.2.0)
#16 273.6   - Installing psutil (5.8.0)
#16 276.8   - Installing requests-oauthlib (1.3.0)
#16 278.7   - Installing smmap (4.0.0)
#16 280.9   - Installing sortedcontainers (2.4.0)
#16 283.1   - Installing tabulate (0.8.9)
#16 285.4   - Installing tblib (1.7.0)
#16 287.8   - Installing toposort (1.6)
#16 290.3   - Installing tornado (6.1)
#16 293.8   - Installing tqdm (4.49.0)
#16 297.4   - Installing watchdog (2.1.3)
#16 299.8   - Installing webencodings (0.5.1)
#16 301.5   - Installing websocket-client (0.59.0)
#16 303.8   - Installing werkzeug (1.0.1)
#16 306.6   - Installing zict (2.0.0)
#16 313.6   - Installing absl-py (0.13.0)
#16 316.3   - Installing async-timeout (3.0.1)
#16 318.4   - Installing bleach (4.0.0)
#16 320.2   - Installing bokeh (2.3.3)
#16 333.7   - Installing cached-property (1.5.2)
#16 335.6   - Installing cfgv (3.3.0)
#16 337.7   - Installing chardet (4.0.0)
#16 340.1   - Installing colorama (0.4.4)
#16 342.1   - Installing configparser (5.0.2)
#16 344.3   - Installing cycler (0.10.0)
#16 346.2   - Installing dagster (0.9.22.post0)
#16 352.0   - Installing defusedxml (0.7.1)
#16 354.5   - Installing distributed (2.30.1)
#16 358.8   - Installing distro (1.6.0)
#16 360.8   - Installing docker (5.0.0)
#16 363.5   - Installing dockerpty (0.4.1)
#16 367.2   - Installing docopt (0.6.2)
#16 370.8   - Installing entrypoints (0.3)
#16 372.9   - Installing flask (1.1.4)
#16 375.4   - Installing gevent-websocket (0.10.1)
#16 378.1   - Installing gitdb (4.0.7)
#16 380.7   - Installing google-auth-oauthlib (0.4.5)
#16 382.9   - Installing graphene (2.1.9)
#16 385.5   - Installing graphql-server-core (1.2.0)
#16 389.1   - Installing identify (2.2.13)
#16 391.5   - Installing joblib (1.0.1)
#16 394.3   - Installing kiwisolver (1.3.1)
#16 397.5   - Installing markdown (3.3.4)
#16 400.2   - Installing marshmallow-enum (1.5.1)
#16 402.3   - Installing mistune (0.8.4)
#16 404.3   - Installing multiprocess (0.70.12.2)
#16 406.8   - Installing nbformat (5.1.3)
#16 409.9   - Installing nodeenv (1.6.0)
#16 412.3   - Installing pandocfilters (1.4.3)
#16 416.2   - Installing pathspec (0.8.1)
#16 418.5   - Installing plumbum (1.7.0)
#16 421.0   - Installing pox (0.3.0)
#16 423.4   - Installing ppft (1.6.6.4)
#16 425.7   - Installing prometheus-client (0.11.0)
#16 428.2   - Installing pydantic (1.8.2)
#16 434.0   - Installing pygments (2.9.0)
#16 438.4   - Installing pymongo (3.12.0)
#16 443.3   - Installing python-dotenv (0.19.0)
#16 446.0   - Installing pyyaml-include (1.2.post2)
#16 448.4   - Installing regex (2020.11.13)
#16 455.4   - Installing s3transfer (0.5.0)
#16 458.2   - Installing stringcase (1.2.0)
#16 462.1   - Installing tensorboard-data-server (0.6.1)
#16 465.9   - Installing tensorboard-plugin-wit (1.8.0)
#16 469.0   - Installing testpath (0.5.0)
#16 471.6   - Installing texttable (1.6.4)
#16 475.1   - Installing toml (0.10.2)
#16 478.2   - Installing torch (1.7.1)
#16 726.6   - Installing typing-inspect (0.7.1)
#16 729.0   - Installing virtualenv (20.7.2)
#16 733.3   - Installing yarl (1.6.3)
#16 736.6   - Installing aiohttp (3.7.4.post0)
#16 741.4   - Installing autologging (1.3.2)
#16 743.9   - Installing boto3 (1.18.19)
#16 748.8   - Installing copier (5.1.0)
#16 751.2   - Installing cryptography (3.4.7)
#16 754.4   - Installing dagster-dask (0.9.22.post0)
#16 757.8   - Installing dagster-graphql (0.9.22.post0)
#16 761.4   - Installing databricks-cli (0.15.0)
#16 766.2   - Installing dataclasses-json (0.5.4)
#16 769.1   - Installing docker-compose (1.29.2)
#16 771.9   - Installing flask-cors (3.0.10)
#16 774.5   - Installing flask-graphql (2.0.1)
#16 778.7   - Installing flask-sockets (0.2.1)
#16 781.2   - Installing gitpython (3.1.20)
#16 784.0   - Installing google-pasta (0.2.0)
#16 786.7   - Installing graphql-ws (0.3.1)
#16 789.2   - Installing gunicorn (20.1.0)
#16 791.9   - Installing huggingface-hub (0.0.2)
#16 794.6   - Installing matplotlib (3.4.2)
#16 804.1   - Installing minio (6.0.2)
#16 806.6   - Installing mongoengine (0.20.0)
#16 809.1   - Installing motor (2.5.0)
#16 811.6   - Installing nbconvert (5.6.1)
#16 814.6   - Installing pathos (0.2.8)
#16 817.3   - Installing pre-commit (2.14.0)
#16 821.0   - Installing prometheus-flask-exporter (0.18.2)
#16 825.4   - Installing protobuf3-to-dict (0.1.5)
#16 829.5   - Installing psycopg2-binary (2.9.1)
#16 833.5   - Installing pyarrow (2.0.0)
#16 841.7   - Installing querystring-parser (1.2.4)
#16 844.8   - Installing sacremoses (0.0.45)
#16 848.8   - Installing scipy (1.7.1)
#16 876.8   - Installing smdebug-rulesconfig (1.0.1)
#16 879.5   - Installing sqlparse (0.4.1)
#16 882.0   - Installing tensorboard (2.6.0)
#16 887.5   - Installing threadpoolctl (2.2.0)
#16 890.4   - Installing tokenizers (0.10.3)
#16 896.3   - Installing torchmetrics (0.3.2)
#16 899.2   - Installing xxhash (2.0.2)
#16 902.1   - Installing dagit (0.9.22.post0)
#16 907.1   - Installing dagster-aws (0.9.22.post0)
#16 911.9   - Installing dagster-pandas (0.9.22.post0)
#16 916.7   - Installing dagster-postgres (0.9.22.post0)
#16 921.8   - Installing datasets (1.4.1)
#16 926.9   - Installing mlflow (1.15.0)
#16 955.0   - Installing pwmf (0.1.3.1.dev1)
#16 957.2 
#16 957.2   EnvCommandError
#16 957.2 
#16 957.2   Command ['/home/worker/python/ontology_tagger/.venv/bin/pip', 'install', '--no-deps', '--index-url', 'https://pkgs.dev.azure.com/iotahoe/Halo/_packaging/private-sources/pypi/simple', 'pwmf==0.1.3.1.dev1'] errored with the following return code 2, and output: 
#16 957.2   Looking in indexes: https://pkgs.dev.azure.com/iotahoe/Halo/_packaging/private-sources/pypi/simple
#16 957.2   User for pkgs.dev.azure.com: ERROR: Exception:
#16 957.2   Traceback (most recent call last):
#16 957.2     File "/home/worker/python/ontology_tagger/.venv/lib/python3.7/site-packages/pip/_internal/cli/base_command.py", line 216, in _main
#16 957.2       status = self.run(options, args)
#16 957.2     File "/home/worker/python/ontology_tagger/.venv/lib/python3.7/site-packages/pip/_internal/cli/req_command.py", line 182, in wrapper
#16 957.2       return func(self, options, args)
#16 957.2     File "/home/worker/python/ontology_tagger/.venv/lib/python3.7/site-packages/pip/_internal/commands/install.py", line 325, in run
#16 957.2       reqs, check_supported_wheels=not options.target_dir
#16 957.2     File "/home/worker/python/ontology_tagger/.venv/lib/python3.7/site-packages/pip/_internal/resolution/legacy/resolver.py", line 183, in resolve
#16 957.2       discovered_reqs.extend(self._resolve_one(requirement_set, req))
#16 957.2     File "/home/worker/python/ontology_tagger/.venv/lib/python3.7/site-packages/pip/_internal/resolution/legacy/resolver.py", line 388, in _resolve_one
#16 957.2       abstract_dist = self._get_abstract_dist_for(req_to_install)
#16 957.2     File "/home/worker/python/ontology_tagger/.venv/lib/python3.7/site-packages/pip/_internal/resolution/legacy/resolver.py", line 339, in _get_abstract_dist_for
#16 957.2       self._populate_link(req)
#16 957.2     File "/home/worker/python/ontology_tagger/.venv/lib/python3.7/site-packages/pip/_internal/resolution/legacy/resolver.py", line 305, in _populate_link
#16 957.2       req.link = self._find_requirement_link(req)
#16 957.2     File "/home/worker/python/ontology_tagger/.venv/lib/python3.7/site-packages/pip/_internal/resolution/legacy/resolver.py", line 270, in _find_requirement_link
#16 957.2       best_candidate = self.finder.find_requirement(req, upgrade)
#16 957.2     File "/home/worker/python/ontology_tagger/.venv/lib/python3.7/site-packages/pip/_internal/index/package_finder.py", line 899, in find_requirement
#16 957.2       req.name, specifier=req.specifier, hashes=hashes,
#16 957.2     File "/home/worker/python/ontology_tagger/.venv/lib/python3.7/site-packages/pip/_internal/index/package_finder.py", line 881, in find_best_candidate
#16 957.2       candidates = self.find_all_candidates(project_name)
#16 957.2     File "/home/worker/python/ontology_tagger/.venv/lib/python3.7/site-packages/pip/_internal/index/package_finder.py", line 826, in find_all_candidates
#16 957.2       project_url, link_evaluator=link_evaluator,
#16 957.2     File "/home/worker/python/ontology_tagger/.venv/lib/python3.7/site-packages/pip/_internal/index/package_finder.py", line 790, in process_project_url
#16 957.2       html_page = self._link_collector.fetch_page(project_url)
#16 957.2     File "/home/worker/python/ontology_tagger/.venv/lib/python3.7/site-packages/pip/_internal/index/collector.py", line 643, in fetch_page
#16 957.2       return _get_html_page(location, session=self.session)
#16 957.2     File "/home/worker/python/ontology_tagger/.venv/lib/python3.7/site-packages/pip/_internal/index/collector.py", line 455, in _get_html_page
#16 957.2       resp = _get_html_response(url, session=session)
#16 957.2     File "/home/worker/python/ontology_tagger/.venv/lib/python3.7/site-packages/pip/_internal/index/collector.py", line 169, in _get_html_response
#16 957.2       "Cache-Control": "max-age=0",
#16 957.2     File "/home/worker/python/ontology_tagger/.venv/lib/python3.7/site-packages/pip/_vendor/requests/sessions.py", line 543, in get
#16 957.2       return self.request('GET', url, **kwargs)
#16 957.2     File "/home/worker/python/ontology_tagger/.venv/lib/python3.7/site-packages/pip/_internal/network/session.py", line 421, in request
#16 957.2       return super(PipSession, self).request(method, url, *args, **kwargs)
#16 957.2     File "/home/worker/python/ontology_tagger/.venv/lib/python3.7/site-packages/pip/_vendor/requests/sessions.py", line 530, in request
#16 957.2       resp = self.send(prep, **send_kwargs)
#16 957.2     File "/home/worker/python/ontology_tagger/.venv/lib/python3.7/site-packages/pip/_vendor/requests/sessions.py", line 650, in send
#16 957.2       r = dispatch_hook('response', hooks, r, **kwargs)
#16 957.2     File "/home/worker/python/ontology_tagger/.venv/lib/python3.7/site-packages/pip/_vendor/requests/hooks.py", line 31, in dispatch_hook
#16 957.2       _hook_data = hook(hook_data, **kwargs)
#16 957.2     File "/home/worker/python/ontology_tagger/.venv/lib/python3.7/site-packages/pip/_internal/network/auth.py", line 256, in handle_401
#16 957.2       username, password, save = self._prompt_for_password(parsed.netloc)
#16 957.2     File "/home/worker/python/ontology_tagger/.venv/lib/python3.7/site-packages/pip/_internal/network/auth.py", line 226, in _prompt_for_password
#16 957.2       username = ask_input("User for {}: ".format(netloc))
#16 957.2     File "/home/worker/python/ontology_tagger/.venv/lib/python3.7/site-packages/pip/_internal/utils/misc.py", line 259, in ask_input
#16 957.2       return input(message)
#16 957.2   EOFError: EOF when reading a line
#16 957.2   WARNING: You are using pip version 20.2.2; however, version 21.2.4 is available.
#16 957.2   You should consider upgrading via the '/home/worker/python/ontology_tagger/.venv/bin/python -m pip install --upgrade pip' command.
#16 957.2   
#16 957.2 
#16 957.2   at /etc/poetry/lib/poetry/utils/env.py:1074 in _run
#16 957.3       1070│                 output = subprocess.check_output(
#16 957.3       1071│                     cmd, stderr=subprocess.STDOUT, **kwargs
#16 957.3       1072│                 )
#16 957.3       1073│         except CalledProcessError as e:
#16 957.3     → 1074│             raise EnvCommandError(e, input=input_)
#16 957.3       1075│ 
#16 957.3       1076│         return decode(output)
#16 957.3       1077│ 
#16 957.3       1078│     def execute(self, bin, *args, **kwargs):
------
executor failed running [/bin/sh -c poetry install --no-dev]: exit code: 1
me@LAPTOP-G1DAPU88:~/.ssh/workers-python/workers/ontology_tagger$ 

Dockerfile (lines 5 to 7):

#https://github.com/moby/buildkit/blob/master/frontend/dockerfile/docs/syntax.md
#require set DOCKER_BUILDKIT=1

FROM python:3.7-slim as base
RUN apt-get update -y \
    && apt-get -y --no-install-recommends install curl wget\
    && rm -rf /var/lib/apt/lists/* 
ENV ROOT /home/worker/python/ontology_tagger
WORKDIR $ROOT

ARG ATLASSIAN_TOKEN
ARG POETRY_HTTP_BASIC_AZURE_PASSWORD
ARG ACCESS_KEY
ENV AWS_ACCESS_KEY_ID=$ACCESS_KEY
ARG SECRET_KEY
ENV AWS_SECRET_ACCESS_KEY=$SECRET_KEY
ARG REPO
ENV REPO_URL=$REPO
# Copy/symlink pypic file to the docker context before running docker build
ENV PYPIRC_PATH=$ROOT/.pypirc

ENV \
    PYTHONFAULTHANDLER=1 \
    POETRY_VERSION=1.1.4 \
    POETRY_HOME=/etc/poetry \
    XDG_CACHE_HOME=/home/worker/.cache \
    POETRY_VIRTUALENVS_IN_PROJECT=true \
    MPLCONFIGDIR=/home/worker/matplotlib \
    PATH=/home/worker/python/ontology_tagger/.venv/bin:/usr/local/bin:/etc/poetry/bin:$PATH

# System deps:
ADD https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py ./
RUN python get-poetry.py && chmod +x /etc/poetry/bin/poetry
# Copy only requirements to cache them in docker layer
RUN --mount=type=cache,target=/root/.cache pip install twine keyring artifacts-keyring
RUN --mount=type=cache,target=/root/.cache apt update && apt install gcc -y

FROM base as ws
ARG WS_APIKEY
ARG WS_PROJECTVERSION=
ARG WS_PROJECTNAME=workers-python-ontology_tagger
ARG WS_PRODUCTNAME=HALO
COPY --chown=worker:worker . .
RUN --mount=type=cache,uid=1000,target=/home/worker/.cache poetry install --no-dev
COPY --from=openjdk:15-slim-buster /usr/local/openjdk-15 /usr/local/openjdk-15
ENV JAVA_HOME /usr/local/openjdk-15
ENV PATH $JAVA_HOME/bin:$PATH
RUN --mount=type=cache,uid=1000,target=/home/worker/.cache ./wss_agent.sh

FROM base as test
COPY . .
RUN poetry config experimental.new-installer false
RUN poetry install
RUN cd ontology_tagger && poetry run invoke deploy
# RUN sphinx-build -b confluence -Q docs/source docs/build -E -a -D confluence_server_pass=$ATLASSIAN_TOKEN

FROM base as package
COPY . .
RUN poetry build
RUN python -m pip install --upgrade pip && \
pip install twine keyring artifacts-keyring && \
twine upload -r $REPO_URL --config-file $PYPIRC_PATH dist/* --skip-existing

FROM base as build
COPY . .
RUN poetry config experimental.new-installer false
RUN poetry install --no-dev
RUN pip3 --no-cache-dir install --upgrade awscli
RUN aws s3 cp s3://iotahoe-datascience/python_workers/dbpedia/output/ontologytagger-2021-05-23-20-49-40-099/output/model.tar.gz $ROOT/ontology_tagger
RUN mkdir $ROOT/ontology_tagger/bert-base-cased && cd $ROOT/ontology_tagger/bert-base-cased && \
wget https://huggingface.co/bert-base-cased/resolve/main/config.json && \
wget https://huggingface.co/bert-base-cased/resolve/main/tokenizer.json && \
wget https://huggingface.co/bert-base-cased/resolve/main/tokenizer_config.json 

FROM python:3.7-slim as production
ENV  ROOT=/home/worker/python/ontology_tagger \
     VIRTUAL_ENV=/home/worker/python/ontology_tagger/.venv\
     PATH=/home/worker/python/ontology_tagger/.venv/bin:/home/worker/python/ontology_tagger:$PATH
COPY --from=build /home/worker/python/ontology_tagger/pyproject.toml /home/worker/python/
COPY --from=build /home/worker/python/ontology_tagger/.venv /home/worker/python/ontology_tagger/.venv
COPY --from=build /home/worker/python/ontology_tagger/ontology_tagger /home/worker/python/ontology_tagger
WORKDIR $ROOT
ENV PYTHONPATH=$ROOT:/home/worker/python/
# args in format mongodb://user:pass@mongodb:27017/ops?authSource=admin,ops,jobs,pipelineId-ce6b9dad-0fa1-42f7-a04d-b54d1468dc7f:ontology_tagger_worker
ENTRYPOINT [ "primary_worker", "--mongo" ]
  • 1
    This is really a question about the APT package manager and not Docker as such, a site like Ask Ubuntu or Unix & Linux SE might be more appropriate. On SO, [Release file for X is not valid yet error in apt-get update](https://stackoverflow.com/questions/62429520/release-file-for-x-is-not-valid-yet-error-in-apt-get-update) has some concrete Docker-related (but not programming-oriented) suggestions. – David Maze Aug 23 '21 at 11:52
  • Awesome, will follow those resources. Thanks. If anyone does know how to solve this problem for me here that would be appreciated. Thanks agin. –  Aug 23 '21 at 11:54
  • I've appended my attempted solution; based on your linked post. This was unsuccessful. This post should now `reopen`. @DavidMaze –  Aug 23 '21 at 12:51

0 Answers0