Skip to content

Commit 313f2de

Browse files
committed
refactor: Update Dockerfile to improve ugrep build process
1 parent d8a1257 commit 313f2de

File tree

1 file changed

+32
-17
lines changed

1 file changed

+32
-17
lines changed

Diff for: Dockerfile

+32-17
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,31 @@
1-
# step 1: create a debian or ubuntu container for ugrep named "ugrep"
2-
# docker -D build --no-cache -t ugrep .
31
#
4-
# step 2: run bash in the container, e.g. to run ugrep from the command line
5-
# docker run -it ugrep bash
6-
# or
7-
# docker run -it --mount type=bind,source=$PWD,target=/mnt ugrep bash
2+
# Dockerfile to build and run ugrep in a container (development environment).
83
#
9-
# step 3: run ugrep in the container, for example:
10-
# ugrep -r -n -tjava Hello ugrep/tests/
4+
# This file creates the environment to build and run ugrep in a container. If
5+
# you just want to use ugrep in a minimal container, use the minimized Dockerfile.
6+
#
7+
# Build the ugrep image:
8+
# $ docker build -t ugrep .
9+
#
10+
# Execute ugrep in the container (The / of the host is accessible in /mnt directory in the container):
11+
# $ docker run -v /:/mnt -it ugrep --help
12+
# or run bash in the container instead:
13+
# $ docker run -v /:/mnt --entrypoint /bin/bash -it ugrep
14+
# $ ugrep --help
1115

12-
# debian or ubuntu
1316
FROM ubuntu
1417

1518
RUN apt-get update
1619

17-
RUN apt-get install -y \
20+
RUN apt-get install -y --no-install-recommends \
21+
autoconf \
22+
automake \
23+
build-essential \
24+
ca-certificates \
25+
pkg-config \
1826
make \
19-
vim \
2027
git \
2128
clang \
22-
wget \
2329
unzip \
2430
libpcre2-dev \
2531
libz-dev \
@@ -29,9 +35,18 @@ RUN apt-get install -y \
2935
libzstd-dev \
3036
libbrotli-dev
3137

32-
RUN cd / && \
33-
git clone https://github.com/Genivia/ugrep
38+
WORKDIR /ugrep
39+
40+
# Clone ugrep from GitHub
41+
RUN git clone --single-branch --depth=1 https://github.com/Genivia/ugrep /ugrep
42+
43+
# Local build of ugrep
44+
# If you want to build ugrep from a local source, uncomment the following line:
45+
# ADD . /ugrep
46+
47+
RUN autoreconf -fi
48+
RUN ./build.sh
49+
RUN make install
50+
RUN ugrep --version
3451

35-
RUN cd ugrep && \
36-
./build.sh && \
37-
make install
52+
ENTRYPOINT [ "ugrep" ]

0 commit comments

Comments
 (0)