Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What is the alpine equivalent to build-essential? #24

Closed
thedug opened this issue Apr 5, 2015 · 21 comments
Closed

What is the alpine equivalent to build-essential? #24

thedug opened this issue Apr 5, 2015 · 21 comments

Comments

@thedug
Copy link

thedug commented Apr 5, 2015

When npm installs mongoose it compiles the c++ bson extension.

On Ubuntu build-essential must be installed in npm install is executed.

What is the equivalent package for alpine?

@progrium
Copy link
Contributor

progrium commented Apr 5, 2015

Not hard to figure out. What's in build-essential?
http://packages.ubuntu.com/lucid/build-essential

Mainly g++ and make:
http://pkgs.alpinelinux.org/package/main/x86/g++
http://pkgs.alpinelinux.org/package/main/x86/make

On Sun, Apr 5, 2015 at 2:31 AM, Douglas Ferguson notifications@github.com
wrote:

When npm installs mongoose it compiles the c++ bson extension.

On Ubuntu build-essential must be installed in npm install is executed.

What is the equivalent package for alpine?


Reply to this email directly or view it on GitHub
#24.

Jeff Lindsay
http://progrium.com

@jumanjiman
Copy link

What is the equivalent package for alpine?

You can start with alpine-sdk, which is a "metapackage that pulls in the most essential packages used to build new packages." http://wiki.alpinelinux.org/wiki/Developer_Documentation has more info.

user@devenv:~$ docker run --rm -it alpine sh
/ # apk add --update alpine-sdk
fetch http://dl-4.alpinelinux.org/alpine/v3.1/main/x86_64/APKINDEX.tar.gz
(1/50) Upgrading musl (1.1.5-r2 -> 1.1.5-r3)
Executing musl-1.1.5-r3.post-upgrade
(2/50) Upgrading musl-utils (1.1.5-r2 -> 1.1.5-r3)
(3/50) Installing fakeroot (1.20.2-r2)
(4/50) Installing sudo (1.8.12-r0)
(5/50) Installing pax-utils (0.8.1-r0)
(6/50) Installing openssl (1.0.1m-r1)
(7/50) Installing run-parts (4.4-r0)
(8/50) Installing lua5.2-libs (5.2.3-r0)
(9/50) Installing lua5.2 (5.2.3-r0)
(10/50) Installing lua5.2-posix (32-r1)
(11/50) Installing ca-certificates (20141019-r0)
(12/50) Installing libssh2 (1.4.3-r0)
(13/50) Installing curl (7.39.0-r0)
(14/50) Installing abuild (2.21.0-r0)
Executing abuild-2.21.0-r0.pre-install
(15/50) Installing binutils-libs (2.24-r3)
(16/50) Installing binutils (2.24-r3)
(17/50) Installing libgomp (4.8.3-r0)
(18/50) Installing pkgconf (0.9.7-r0)
(19/50) Installing pkgconfig (0.25-r1)
(20/50) Installing gmp5 (5.1.3-r0)
(21/50) Installing mpfr3 (3.1.2-r0)
(22/50) Installing mpc1 (1.0.1-r0)
(23/50) Installing gcc (4.8.3-r0)
(24/50) Installing make (4.1-r0)
(25/50) Installing patch (2.7.5-r0)
(26/50) Installing musl-dbg (1.1.5-r3)
(27/50) Installing musl-dev (1.1.5-r3)
(28/50) Installing linux-headers (3.12.6-r1)
(29/50) Installing libc-dev (0.6-r0)
(30/50) Installing libgcc (4.8.3-r0)
(31/50) Installing libstdc++ (4.8.3-r0)
(32/50) Installing g++ (4.8.3-r0)
(33/50) Installing build-base (0.3-r0)
(34/50) Installing expat (2.1.0-r1)
(35/50) Installing pcre (8.36-r1)
(36/50) Installing git (2.2.1-r0)
(37/50) Installing xz-libs (5.0.7-r0)
(38/50) Installing lzo (2.08-r0)
(39/50) Installing squashfs-tools (4.3-r0)
(40/50) Installing file (5.22-r0)
(41/50) Installing bzip2 (1.0.6-r3)
(42/50) Installing libbz2 (1.0.6-r3)
(43/50) Installing libattr (2.4.47-r3)
(44/50) Installing libcap (2.24-r0)
(45/50) Installing cdrkit (1.1.11-r2)
(46/50) Installing acct (6.6.1-r0)
(47/50) Installing lddtree (1.25-r1)
(48/50) Installing mkinitfs (2.7.1-r1)
(49/50) Installing mtools (4.0.18-r0)
(50/50) Installing alpine-sdk (0.4-r1)
Executing busybox-1.22.1-r14.trigger
Executing ca-certificates-20141019-r0.trigger
OK: 151 MiB in 63 packages

@progrium
Copy link
Contributor

progrium commented Apr 5, 2015

Actually that points out the clearest, most similar package to
build-essential for your purpose:
http://pkgs.alpinelinux.org/package/main/x86/build-base

On Sun, Apr 5, 2015 at 8:35 AM, Paul Morgan notifications@github.com
wrote:

What is the equivalent package for alpine?

You can start with alpine-sdk, which is a "metapackage that pulls in the
most essential packages used to build new packages."
http://wiki.alpinelinux.org/wiki/Developer_Documentation has more info.

user@devenv:~$ docker run --rm -it alpine sh/ # apk add --update alpine-sdkfetch http://dl-4.alpinelinux.org/alpine/v3.1/main/x86_64/APKINDEX.tar.gz(1/50) Upgrading musl (1.1.5-r2 -> 1.1.5-r3)Executing musl-1.1.5-r3.post-upgrade(2/50) Upgrading musl-utils (1.1.5-r2 -> 1.1.5-r3)(3/50) Installing fakeroot (1.20.2-r2)(4/50) Installing sudo (1.8.12-r0)(5/50) Installing pax-utils (0.8.1-r0)(6/50) Installing openssl (1.0.1m-r1)(7/50) Installing run-parts (4.4-r0)(8/50) Installing lua5.2-libs (5.2.3-r0)(9/50) Installing lua5.2 (5.2.3-r0)(10/50) Installing lua5.2-posix (32-r1)(11/50) Installing ca-certificates (20141019-r0)(12/50) Installing libssh2 (1.4.3-r0)(13/50) Installing curl (7.39.0-r0)(14/50) Installing abuild (2.21.0-r0)Executing abuild-2.21.0-r0.pre-install(15/50) Installing binutils-libs (2.24-r3)(16/50) Installing binutils (2.24-r3)(17/50) Installing libgomp (4.8.3-r0)(18/50) Installing pkgconf (0.9.7-r0)(19/50) Installing pkgconfig (0.25-r1)(20/50) Installing gmp5 (5.1.3-r0)(21/50) Installing mpfr3 (3.1.2-r0)(22/50) Installing mpc1 (1.0.1-r0)(23/50) Installing gcc (4.8.3-r0)(24/50) Installing make (4.1-r0)(25/50) Installing patch (2.7.5-r0)(26/50) Installing musl-dbg (1.1.5-r3)(27/50) Installing musl-dev (1.1.5-r3)(28/50) Installing linux-headers (3.12.6-r1)(29/50) Installing libc-dev (0.6-r0)(30/50) Installing libgcc (4.8.3-r0)(31/50) Installing libstdc++ (4.8.3-r0)(32/50) Installing g++ (4.8.3-r0)(33/50) Installing build-base (0.3-r0)(34/50) Installing expat (2.1.0-r1)(35/50) Installing pcre (8.36-r1)(36/50) Installing git (2.2.1-r0)(37/50) Installing xz-libs (5.0.7-r0)(38/50) Installing lzo (2.08-r0)(39/50) Installing squashfs-tools (4.3-r0)(40/50) Installing file (5.22-r0)(41/50) Installing bzip2 (1.0.6-r3)(42/50) Installing libbz2 (1.0.6-r3)(43/50) Installing libattr (2.4.47-r3)(44/50) Installing libcap (2.24-r0)(45/50) Installing cdrkit (1.1.11-r2)(46/50) Installing acct (6.6.1-r0)(47/50) Installing lddtree (1.25-r1)(48/50) Installing mkinitfs (2.7.1-r1)(49/50) Installing mtools (4.0.18-r0)(50/50) Installing alpine-sdk (0.4-r1)Executing busybox-1.22.1-r14.triggerExecuting ca-certificates-20141019-r0.triggerOK: 151 MiB in 63 packages


Reply to this email directly or view it on GitHub
#24 (comment)
.

Jeff Lindsay
http://progrium.com

@andyshinn
Copy link
Contributor

Re-open if this wasn't what you were looking for.

@davetron5000
Copy link

https://pkgs.alpinelinux.org/package/v3.6/main/ppc64le/build-base is the latest link. The one in the other comment is now a 404.

If you are coming here from the future, you probably want to go here: https://pkgs.alpinelinux.org/packages?name=build-base&branch=&repo=&arch=&maintainer=

and pick the latest version (or correct version for whatever you are doing)

@petergi
Copy link

petergi commented Aug 7, 2018

RUN apk update
&& apk add --virtual build-dependencies
build-base
gcc
wget
git

@javierojeda94
Copy link

javierojeda94 commented Sep 27, 2018

What's the difference between build-base vs build-dependencies?

@Gelmo
Copy link

Gelmo commented Sep 27, 2018

@javierojeda94 build-dependencies isn't an alpine package. The --virtual tag allows you to add the following packages as a virtual group, for managing as a single package. For example, after that operation you could do apk del build-dependencies and it would delete all of those packages

@javierojeda94
Copy link

Oh! Ok, so with that --virtual I'm able to install that build-dependencies package despite the fact that it is not an alpine package?

Does that work the same with another non-alpine packages?

Sorry for dumb questions, I'm new on alpine

@Gelmo
Copy link

Gelmo commented Sep 27, 2018

@javierojeda94 Not quite. With the --virtual tag the argument immediately following is what the group is named. The command above creates a group called build-dependencies, consisting of build-base, gcc, wget, and git, and then installs those 4 packages.

@javierojeda94
Copy link

Oh, that makes much more sense to me now! Thanks for the clarification!

@rdcdev
Copy link

rdcdev commented Aug 7, 2019

apk add build-base

@crakama
Copy link

crakama commented Feb 6, 2020

If you follow the above and still get cryptograpghy error when running in .gitlab-ci.yml file with runner deployed in AWS

  • apk add --update alpine-sdk && \
  • apk add libffi-dev openssl-dev && \
  • apk --no-cache --update add build-base

@adityagundecha
Copy link

I tried every possible combination given in this thread. still getting this issue.

using python3 and pip3 in an alpine image

Collecting cryptography>=2.1.4 (from azure-storage-blob==12.3.1->-r ./requirements.txt (line 2))
Downloading https://files.pythonhosted.org/packages/56/3b/78c6816918fdf2405d62c98e48589112669f36711e50158a0c15d804c30d/cryptography-2.9.2.tar.gz (517kB)
Installing build dependencies: started
Installing build dependencies: finished with status 'error'
Complete output from command /usr/bin/python3.6 -m pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-0olxhwr0 --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools>=40.6.0 wheel "cffi>=1.8,!=1.11.3; platform_python_implementation != 'PyPy'":
Collecting setuptools>=40.6.0
Downloading https://files.pythonhosted.org/packages/a0/df/635cdb901ee4a8a42ec68e480c49f85f4c59e8816effbf57d9e6ee8b3588/setuptools-46.1.3-py3-none-any.whl (582kB)
Collecting wheel
Downloading https://files.pythonhosted.org/packages/8c/23/848298cccf8e40f5bbb59009b32848a4c38f4e7f3364297ab3c3e2e2cd14/wheel-0.34.2-py2.py3-none-any.whl
Collecting cffi!=1.11.3,>=1.8
Downloading https://files.pythonhosted.org/packages/05/54/3324b0c46340c31b909fcec598696aaec7ddc8c18a63f2db352562d3354c/cffi-1.14.0.tar.gz (463kB)
Collecting pycparser (from cffi!=1.11.3,>=1.8)
Downloading https://files.pythonhosted.org/packages/ae/e7/d9c3a176ca4b02024debf82342dab36efadfc5776f9c8db077e8f6e71821/pycparser-2.20-py2.py3-none-any.whl (112kB)
Installing collected packages: setuptools, wheel, pycparser, cffi
Running setup.py install for cffi: started
Running setup.py install for cffi: finished with status 'error'
Complete output from command /usr/bin/python3.6 -u -c "import setuptools, tokenize;file='/tmp/pip-install-tnyaa9v8/cffi/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /tmp/pip-record-ezer4lka/install-record.txt --single-version-externally-managed --prefix /tmp/pip-build-env-0olxhwr0 --compile:
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.6
creating build/lib.linux-x86_64-3.6/cffi
copying cffi/backend_ctypes.py -> build/lib.linux-x86_64-3.6/cffi
copying cffi/vengine_gen.py -> build/lib.linux-x86_64-3.6/cffi
copying cffi/vengine_cpy.py -> build/lib.linux-x86_64-3.6/cffi
copying cffi/cparser.py -> build/lib.linux-x86_64-3.6/cffi
copying cffi/error.py -> build/lib.linux-x86_64-3.6/cffi
copying cffi/cffi_opcode.py -> build/lib.linux-x86_64-3.6/cffi
copying cffi/init.py -> build/lib.linux-x86_64-3.6/cffi
copying cffi/model.py -> build/lib.linux-x86_64-3.6/cffi
copying cffi/commontypes.py -> build/lib.linux-x86_64-3.6/cffi
copying cffi/verifier.py -> build/lib.linux-x86_64-3.6/cffi
copying cffi/ffiplatform.py -> build/lib.linux-x86_64-3.6/cffi
copying cffi/recompiler.py -> build/lib.linux-x86_64-3.6/cffi
copying cffi/pkgconfig.py -> build/lib.linux-x86_64-3.6/cffi
copying cffi/lock.py -> build/lib.linux-x86_64-3.6/cffi
copying cffi/setuptools_ext.py -> build/lib.linux-x86_64-3.6/cffi
copying cffi/api.py -> build/lib.linux-x86_64-3.6/cffi
copying cffi/_cffi_include.h -> build/lib.linux-x86_64-3.6/cffi
copying cffi/parse_c_type.h -> build/lib.linux-x86_64-3.6/cffi
copying cffi/_embedding.h -> build/lib.linux-x86_64-3.6/cffi
copying cffi/_cffi_errors.h -> build/lib.linux-x86_64-3.6/cffi
running build_ext
building '_cffi_backend' extension
creating build/temp.linux-x86_64-3.6
creating build/temp.linux-x86_64-3.6/c
gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Os -fomit-frame-pointer -g -Os -fomit-frame-pointer -g -Os -fomit-frame-pointer -g -DTHREAD_STACK_SIZE=0x100000 -fPIC -DUSE__THREAD -DHAVE_SYNC_SYNCHRONIZE -I/usr/include/python3.6m -c c/_cffi_backend.c -o build/temp.linux-x86_64-3.6/c/_cffi_backend.o
c/_cffi_backend.c:2:10: fatal error: Python.h: No such file or directory
#include <Python.h>
^~~~~~~~~~
compilation terminated.
error: command 'gcc' failed with exit status 1

   ----------------------------------------

Command "/usr/bin/python3.6 -u -c "import setuptools, tokenize;file='/tmp/pip-install-tnyaa9v8/cffi/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /tmp/pip-record-ezer4lka/install-record.txt --single-version-externally-managed --prefix /tmp/pip-build-env-0olxhwr0 --compile" failed with error code 1 in /tmp/pip-install-tnyaa9v8/cffi/
You are using pip version 18.1, however version 20.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.


Command "/usr/bin/python3.6 -m pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-0olxhwr0 --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools>=40.6.0 wheel "cffi>=1.8,!=1.11.3; platform_python_implementation != 'PyPy'"" failed with error code 1 in None
You are using pip version 18.1, however version 20.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
ERROR: Job failed: exit code 1

@adityagundecha
Copy link

  • apk add --update-cache
    • apk add --update alpine-sdk &&
      apk add libffi-dev openssl-dev &&
      apk --no-cache --update add build-base
    • pip3 install -r ./requirements.txt

This is the command I am trying to execute

@SuperSandro2000
Copy link

you are missing python3-dev

https://pkgs.alpinelinux.org/contents?file=Python.h&path=&name=&branch=v3.11&arch=x86_64

@marfier
Copy link

marfier commented Oct 16, 2020

I know this is quite old, but what is the difference between alpine-sdk and build-base?

@hakpw
Copy link

hakpw commented Oct 16, 2020

@GalacticLion7
Just run apk info -R pkg_name

In a nutshell, alpine-sdk is a superset of build-base.

@FrankFang
Copy link

alpine-sdk is a superset of build-base:

Why? I don't see build-base in the list of alpine-sdk.

@hakpw
Copy link

hakpw commented Aug 25, 2021

alpine-sdk is a superset of build-base:

Why? I don't see build-base in the list of alpine-sdk.

It seems like it's a moving target! Rerunning those commands now gives me:

build-base-0.5-r2 depends on:
binutils
file
gcc
g++
make
libc-dev
fortify-headers
patch

/ # apk info -R alpine-sdk
alpine-sdk-1.0-r1 depends on:
abuild
build-base
git

Above ran under:

NAME="Alpine Linux"
ID=alpine
VERSION_ID=3.14.1
PRETTY_NAME="Alpine Linux v3.14"
HOME_URL="https://alpinelinux.org/"
BUG_REPORT_URL="https://bugs.alpinelinux.org/"

@cornflowerblu
Copy link

cornflowerblu commented Nov 4, 2021

You only need the ubuntu piece during the build phase. Outside of that it's just a normal Next Dockerfile. Hope this helps! Sorry about the formatting... first time posting here :)

Install dependencies only when needed

FROM node:alpine AS deps
RUN apk add --no-cache libc6-compat
WORKDIR /app
COPY package.json yarn.lock ./
RUN yarn install --frozen-lockfile`

Rebuild the source code only when needed

FROM ubuntu:18.04 AS builder

Install Node.js

RUN apt-get update
RUN apt-get -y install curl
RUN apt-get -y install sudo
RUN useradd -m docker && echo "docker:docker" | chpasswd && adduser docker sudo
RUN curl -fsSL https://deb.nodesource.com/setup_14.x | sudo -E bash -
RUN apt-get install -y build-essential
RUN apt-get install -y nodejs

Install Yarn

RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
RUN sudo apt-get update
RUN sudo apt-get install yarn

Build the project

WORKDIR /app
COPY . .
COPY --from=deps /app/node_modules ./node_modules
RUN yarn build && yarn install --production --ignore-scripts --prefer-offline

Production image, copy all the files and run next

FROM node:alpine AS runner
WORKDIR /app

ENV NODE_ENV production

RUN addgroup -g 1001 -S nodejs
RUN adduser -S nextjs -u 1001

You only need to copy next.config.js if you are NOT using the default configuration

COPY --from=builder /app/next.config.js ./

COPY --from=builder /app/public ./public
COPY --from=builder --chown=nextjs:nodejs /app/.next ./.next
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/package.json ./package.json

USER nextjs

EXPOSE 3000

ENV PORT 3000

Next.js collects completely anonymous telemetry data about general usage.

Learn more here: https://nextjs.org/telemetry

Uncomment the following line in case you want to disable telemetry.

ENV NEXT_TELEMETRY_DISABLED 1

CMD ["node_modules/.bin/next", "start"]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests