Dockerfile.alpine: cleanup, add tools like tmux, micro for easing diagnostics and more prolonged work

This commit is contained in:
Delyan Angelov 2025-01-07 15:53:27 +02:00
parent 63db71b650
commit 68829003b8
No known key found for this signature in database
GPG key ID: 66886C0F12D595ED

View file

@ -1,29 +1,20 @@
## Usage:
## 1) docker build -t vlang_alpine - < Dockerfile.alpine
## 2) alias with_alpine='docker run -u 1000:1000 --rm -it -v .:/src -w /src vlang_alpine:latest'
FROM alpine:3.20 FROM alpine:3.20
LABEL maintainer="spytheman <spytheman@bulsynt.org>" LABEL maintainer="spytheman <spytheman@bulsynt.org>"
WORKDIR /opt/vlang WORKDIR /opt/vlang
ENV PATH /opt/vlang:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin ENV PATH /opt/vlang:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
## install development packages ## install development packages
RUN apk --no-cache add \ RUN apk --no-cache add \
musl-dev libc-dev libc6-compat gcompat musl-dev libc-dev libc6-compat gcompat \
RUN apk --no-cache add \
openssl-dev sqlite-dev mbedtls \ openssl-dev sqlite-dev mbedtls \
libuv-dev libev-dev libevent-dev libmemcached-dev libuv-dev libev-dev libevent-dev libmemcached-dev \
RUN apk --no-cache add \
binutils diffutils elfutils pcre strace \ binutils diffutils elfutils pcre strace \
libunwind-dev libunwind-static gc libunwind-dev libunwind-static gc gc-dev \
make bash file git upx tmux micro nano nano-syntax \
RUN apk --no-cache add \ gcc gdb wasi-sdk \
make bash file git upx
RUN apk --no-cache add gcc gdb wasi-sdk
RUN apk --no-cache add \
mesa-dev mesa-gl mesa-gles mesa-glapi \ mesa-dev mesa-gl mesa-gles mesa-glapi \
glfw-dev \ glfw-dev \
glu-dev \ glu-dev \
@ -32,9 +23,7 @@ RUN apk --no-cache add \
freeglut-dev \ freeglut-dev \
libxi-dev libxi-static \ libxi-dev libxi-static \
libxcursor-dev \ libxcursor-dev \
libx11-dev libx11-dev \
RUN apk --no-cache add \
icu-data-full \ icu-data-full \
sdl2_net-dev \ sdl2_net-dev \
sdl2_gfx-dev \ sdl2_gfx-dev \
@ -45,9 +34,7 @@ RUN apk --no-cache add \
sdl2-dev sdl2-dev
RUN ln -s /opt/vlang/v /usr/local/bin/v RUN ln -s /opt/vlang/v /usr/local/bin/v
COPY . /vlang-local COPY . /vlang-local
ARG USE_LOCAL ARG USE_LOCAL
RUN if [[ -z "${USE_LOCAL}" ]] ; then \ RUN if [[ -z "${USE_LOCAL}" ]] ; then \
git clone --depth=1 --quiet https://github.com/vlang/v/ /opt/vlang && \ git clone --depth=1 --quiet https://github.com/vlang/v/ /opt/vlang && \
@ -56,22 +43,20 @@ RUN if [[ -z "${USE_LOCAL}" ]] ; then \
mv /vlang-local/* . && \ mv /vlang-local/* . && \
rm -rf /vlang-local ; \ rm -rf /vlang-local ; \
fi fi
RUN mkdir -p /tmp/v /tmp/v /home/ && chown -Rh 1000:1000 /opt/ /tmp/ /home/ RUN mkdir -p /tmp/v /tmp/v /home/ && chown -Rh 1000:1000 /opt/ /tmp/ /home/
## setup runtime environment for v and bash: ## setup runtime environment for v and bash:
USER 1000:1000 USER 1000:1000
ENV HOME /home ENV HOME /home
ENV VTMP /tmp/v ENV VTMP /tmp/v
ENV VMODULES /tmp/vmodules ENV VMODULES /tmp/vmodules
RUN make && v -version && ls -la v RUN make && v -version && ls -la v && \
RUN du -b -s . du -b -s . && \
RUN time v -prod -skip-unused doctor time v doctor && \
RUN time v -prod -skip-unused self time v cmd/tools/vfmt.v && \
RUN time v -prod -skip-unused cmd/tools/vfmt.v time v -prod self && \
RUN find . -type f -name *_test.v -or -name *.vv -or -name *.out | xargs rm true
RUN rm -rf v_old vc/ .git/ RUN find . -type f -name *_test.v -or -name *.vv -or -name *.out | xargs rm && \
RUN du -b -s . rm -rf v_old vc/ .git/ && \
du -b -s .
CMD ["v"] CMD ["v"]