Skip to content

Commit 0a8c18a

Browse files
authored
feat: Example of alpine image (#458)
1 parent 8bf1828 commit 0a8c18a

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Use alpine latest as the base image
2+
FROM alpine:latest as builder
3+
4+
# Build variables
5+
ARG NITRO_VERSION=0.3.14
6+
7+
# Create build directory
8+
WORKDIR /work
9+
10+
# Install build dependencies
11+
RUN apk add --no-cache git cmake g++ make util-linux-dev zlib-dev
12+
13+
# Clone code
14+
RUN git clone --recurse-submodules -j2 --depth 1 --branch v${NITRO_VERSION} --single-branch https://github.com/janhq/nitro.git
15+
16+
# Build
17+
RUN cd nitro && \
18+
cmake -S nitro_deps/ -B ./build_deps/nitro_deps && \
19+
cmake --build ./build_deps/nitro_deps/ --config Release && \
20+
mkdir build && \
21+
cd build && \
22+
cmake .. && \
23+
make -j $(nproc) && \
24+
chmod +x ./nitro
25+
26+
# Create the final image
27+
FROM alpine:latest
28+
29+
# Install runtime dependencies from stripped down g++ and util-linux-dev (without dev packages)
30+
RUN apk add --no-cache libstdc++ gmp isl25 mpc1 mpfr4 zlib libuuid
31+
32+
# Create working directory
33+
WORKDIR /app
34+
35+
# Copy the binary from the builder image
36+
COPY --from=builder /work/nitro/build/nitro /app/nitro
37+
38+
# Expose port
39+
EXPOSE 3928
40+
41+
# Set the command to run nitro
42+
ENTRYPOINT [ "/app/nitro" ]
43+
CMD [ "1", "0.0.0.0", "3928" ]

0 commit comments

Comments
 (0)