# STklos Dockerfile 
#
# Build an STklos image on top of Alpine Linux
#
#           Author: Erick Gallesio [eg@unice.fr]
#    Creation date:  3-Jun-2019 11:28

# The image is created from the git version of STklos
#
# To build an image on your machine, place yourself in this directory
# and type (don't forget the final dot)
#    $ docker build -f Dockerfile.latest -t stklos:latest .
# 

# ---------- Build stage
FROM alpine:3.15 AS build
RUN apk update && \
    apk add build-base automake autoconf git \
        gc-dev gmp-dev libffi-dev pcre2-dev

WORKDIR /build
RUN git clone https://github.com/egallesio/STklos.git stklos
WORKDIR /build/stklos
RUN env CFLAGS='-O3' ./configure \
    --without-provided-bignum \
    --without-provided-gc     \
    --without-provided-regexp \
    --without-provided-ffi
RUN env TERM="dumb" make all tests install

# ---------- Running stage
FROM alpine:3.15
RUN apk update && \
    apk add gc gmp libffi pcre2 readline
COPY --from=build /usr/local/ /usr/local/
RUN ln -s /usr/lib/libreadline.so.8.1 /usr/lib/libreadline.so
WORKDIR /home
CMD ["stklos", "--utf8-encoding=yes"]

# Local Variables:
# mode: dockerfile
# coding: utf-8
# End:
