-
Notifications
You must be signed in to change notification settings - Fork 86
/
Dockerfile
56 lines (43 loc) · 1.54 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# Start the build image
FROM alpine:3 as build
# A comma seperated list of extra plugins to compile
ARG plugins=""
# The configure argument is passed to the ./configure script
ARG configure=""
# Update package list and upgrade, and install build dependencies
RUN apk update && apk upgrade --no-cache && \
apk add --no-cache autoconf automake c-ares-dev curl-dev g++ libtool make zlib
# Create and switch to a normal user for the build
RUN adduser -S builder
USER builder
WORKDIR /home/builder
# Copy the local source directory into the docker environment
COPY --chown=builder:nogroup . bzflag/
WORKDIR /home/builder/bzflag
# Run the build process
RUN ./autogen.sh && \
./configure \
--disable-bzadmin \
--disable-client \
--enable-custom-plugins="$plugins" \
$configure && \
make -j$(nproc)
# Switch to root to run the install step
USER root
RUN make install-strip
# Start the final image
FROM alpine:3
# Update package list and upgrade, and install runtime dependencies. Add a user
# and create a data directory owned by said user.
RUN apk update && apk upgrade --no-cache && \
apk add --no-cache c-ares libcurl libgcc libstdc++ zlib && \
adduser -S bzfsd && \
mkdir /data && chown bzfsd:nogroup /data
# Copy in files from the build
COPY --from=build /usr/local/bin/bzfs /usr/local/bin/bzfs
COPY --from=build /usr/local/lib/bzflag /usr/local/lib/bzflag
# Switch to the user and work out of the /data directory, which can be passed
# in as a volume.
USER bzfsd
WORKDIR /data
ENTRYPOINT [ "/usr/local/bin/bzfs" ]