nikolaik / docker-python-nodejs

🐳 Python with Node.js docker image

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build personal version

claudioferrari opened this issue · comments

Hello guys,

how to build a personal image, I need python2.7 and node14.5

Thanks

You can use https://github.com/nikolaik/docker-python-nodejs/blob/main/Dockerfile and adapt it to your needs.

With a few changes (dropped poetry) this can probably help you:

FROM python:2.7
LABEL org.opencontainers.image.authors="Nikolai R Kristiansen <nikolaik@gmail.com>"

RUN groupadd --gid 1000 pn && useradd --uid 1000 --gid pn --shell /bin/bash --create-home pn
ENV POETRY_HOME=/usr/local
# Install node prereqs, nodejs and yarn
# Ref: https://deb.nodesource.com/setup_14.x
# Ref: https://yarnpkg.com/en/docs/install
RUN \
  echo "deb https://deb.nodesource.com/node_14.x buster main" > /etc/apt/sources.list.d/nodesource.list && \
  wget -qO- https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add - && \
  echo "deb https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list && \
  wget -qO- https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \
  apt-get update && \
  apt-get upgrade -yqq && \
  apt-get install -yqq nodejs yarn && \
  pip install -U pip && pip install pipenv && \
  npm i -g npm@^8 && \
  rm -rf /var/lib/apt/lists/*

Thank you!

Buto still give me this error:
python3 build_versions/main.py -d "alpine" --dockerfile-from-config "Dockerfile" --verbose --dry-run --force
Namespace(distros=['alpine'], dry_run=True, ci_config=False, ci_trigger='webhook', release=False, dockerfile_from_config=<_io.TextIOWrapper name='Dockerfile' mode='r' encoding='UTF-8'>, force=True, verbose=True)
Traceback (most recent call last):
File "/Users/claudio/www/works/tuc/docker-python-nodejs/build_versions/main.py", line 66, in
main(
File "/Users/claudio/www/works/tuc/docker-python-nodejs/build_versions/main.py", line 13, in main
render_dockerfile_by_config(dockerfile_config, dry_run)
File "/Users/claudio/www/works/tuc/docker-python-nodejs/build_versions/dockerfile.py", line 45, in render_dockerfile_by_config
version = json.load(fp)
^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/python@3.11/3.11.2_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/json/init.py", line 293, in load
return loads(fp.read(),
^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/python@3.11/3.11.2_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/json/init.py", line 346, in loads
return _default_decoder.decode(s)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/python@3.11/3.11.2_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/python@3.11/3.11.2_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Buto still give me this error

You don't need to run the build scripts, you can simply use the docker cli to build your image with the above Dockerfile with docker build ..

Perfect, thanks again!