Skip to content

feat: Example of alpine image #458

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

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions examples/example-docker/alpine.Dockerfile
Original file line number Diff line number Diff line change
@@ -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" ]