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

Alpine Linux images #10

Open
0xEAB opened this issue Aug 29, 2023 · 2 comments
Open

Alpine Linux images #10

0xEAB opened this issue Aug 29, 2023 · 2 comments
Labels
help wanted Extra attention is needed image New or missing image

Comments

@0xEAB
Copy link
Member

0xEAB commented Aug 29, 2023

We should also provide images based on Alpine Linux.

People like to use Alpine Linux as their base image because it’s lightweight.
Ref: https://hub.docker.com/_/alpine

@0xEAB 0xEAB added the image New or missing image label Aug 29, 2023
@kassane
Copy link

kassane commented Apr 4, 2024

Note: For amd64/aarch64, when try build dub with ldmd2 (instead dmd) get mmap64 error!!

alpine-ldc2 sample
ARG IMAGE=alpine
ARG BASE_VERSION=latest

FROM ${IMAGE}:${BASE_VERSION}

RUN apk update && apk add --no-cache \
        sudo \
        dmd \
        clang \
        cmake \
        ninja \
        llvm-dev \
        llvm-libunwind-static \
        llvm-static

RUN cd /root
RUN wget -q -c https://github.com/ldc-developers/ldc/releases/download/v1.37.0/ldc-1.37.0-src.tar.gz && tar xf ldc-1.37.0-src.tar.gz
RUN cd ldc-1.37.0-src \
    && cmake -B build \
    -DCMAKE_INSTALL_PREFIX="/usr" \
    -GNinja \
    -DCMAKE_C_COMPILER=clang \
    -DCMAKE_CXX_COMPILER=clang++ \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_EXE_LINKER_FLAGS=-static-libstdc++ \
    -DLLVM_IS_SHARED=OFF \
    && cmake --build build --parallel \
    && ninja -C build install \
    && cd ..
RUN wget -q -c https://github.com/dlang/dub/archive/refs/tags/v1.37.0.tar.gz \
    && tar xf v1.37.0.tar.gz \
    && cd dub-1.37.0 \
    && dmd -O build.d && $PWD/build \
    && chmod +x $PWD/bin/dub \
    && mv $PWD/bin/dub /usr/bin/dub \
    && cd ..

RUN apk del dmd cmake ninja \
    && rm -fr ldc-1.37.0-src* dub-1.37.0 v1.37.0.tar.gz

WORKDIR /app

ARG UNAME=dman
ARG UID=1000
ARG GID=1000
RUN addgroup -S $UNAME
RUN adduser \
    --disabled-password \
    --gecos "" \
    --home "$(pwd)" \
    --ingroup "$UNAME" \
    --no-create-home \
    --uid "$UID" \
    "$UNAME"
RUN echo "$UNAME ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/$UNAME \
        && chmod 0440 /etc/sudoers.d/$UNAME

RUN chown -R $UNAME:$UNAME /app

USER $UNAME

cc: @0xEAB

@kassane
Copy link

kassane commented Apr 7, 2024

@0xEAB 0xEAB added the help wanted Extra attention is needed label Jul 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed image New or missing image
Projects
None yet
Development

No branches or pull requests

2 participants