diff --git a/examples/example-docker/alpine.Dockerfile b/examples/example-docker/alpine.Dockerfile new file mode 100644 index 000000000..b80d87009 --- /dev/null +++ b/examples/example-docker/alpine.Dockerfile @@ -0,0 +1,43 @@ +# Use alpine latest as the base image +FROM alpine:latest as builder + +# Build variables +ARG NITRO_VERSION=0.3.14 + +# Create build directory +WORKDIR /work + +# Install build dependencies +RUN apk add --no-cache git cmake g++ make util-linux-dev zlib-dev + +# Clone code +RUN git clone --recurse-submodules -j2 --depth 1 --branch v${NITRO_VERSION} --single-branch https://github.com/janhq/nitro.git + +# Build +RUN cd nitro && \ + cmake -S nitro_deps/ -B ./build_deps/nitro_deps && \ + cmake --build ./build_deps/nitro_deps/ --config Release && \ + mkdir build && \ + cd build && \ + cmake .. && \ + make -j $(nproc) && \ + chmod +x ./nitro + +# Create the final image +FROM alpine:latest + +# Install runtime dependencies from stripped down g++ and util-linux-dev (without dev packages) +RUN apk add --no-cache libstdc++ gmp isl25 mpc1 mpfr4 zlib libuuid + +# Create working directory +WORKDIR /app + +# Copy the binary from the builder image +COPY --from=builder /work/nitro/build/nitro /app/nitro + +# Expose port +EXPOSE 3928 + +# Set the command to run nitro +ENTRYPOINT [ "/app/nitro" ] +CMD [ "1", "0.0.0.0", "3928" ]