Skip to content

Commit 32ddef2

Browse files
authored
Refactor Docker image (#66)
1 parent fccbd29 commit 32ddef2

File tree

1 file changed

+23
-16
lines changed

1 file changed

+23
-16
lines changed

Dockerfile

+23-16
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# Copyright 2019-present Open Networking Foundation
2+
# Copyright 2024-present Intel Corporation
23
#
34
# SPDX-License-Identifier: Apache-2.0
45
#
@@ -7,16 +8,22 @@ FROM golang:1.22.0-bookworm AS builder
78

89
LABEL maintainer="ONF <[email protected]>"
910

10-
RUN apt-get update && apt-get -y install apt-transport-https ca-certificates
11-
RUN apt-get update
12-
RUN apt-get -y install gcc cmake autoconf libtool pkg-config libmnl-dev libyaml-dev
13-
RUN apt-get clean
14-
15-
16-
RUN cd $GOPATH/src && mkdir -p udr
17-
COPY . $GOPATH/src/udr
18-
RUN cd $GOPATH/src/udr \
19-
&& make all
11+
RUN apt-get update && \
12+
apt-get -y install --no-install-recommends \
13+
apt-transport-https \
14+
ca-certificates \
15+
gcc \
16+
cmake \
17+
autoconf \
18+
libtool \
19+
pkg-config \
20+
libmnl-dev \
21+
libyaml-dev && \
22+
apt-get clean
23+
24+
WORKDIR $GOPATH/src/udr
25+
COPY . .
26+
RUN make all
2027

2128
FROM alpine:3.19 as udr
2229

@@ -25,13 +32,13 @@ LABEL description="ONF open source 5G Core Network" \
2532

2633
ARG DEBUG_TOOLS
2734

28-
# Install debug tools ~ 100MB (if DEBUG_TOOLS is set to true)
29-
RUN apk update && apk add -U vim strace net-tools curl netcat-openbsd bind-tools
35+
# Install debug tools ~ 50MB (if DEBUG_TOOLS is set to true)
36+
RUN if [ "$DEBUG_TOOLS" = "true" ]; then \
37+
apk update && apk add --no-cache -U vim strace net-tools curl netcat-openbsd bind-tools; \
38+
fi
3039

3140
# Set working dir
32-
WORKDIR /free5gc
33-
RUN mkdir -p udr/
41+
WORKDIR /free5gc/udr
3442

3543
# Copy executable and default certs
36-
COPY --from=builder /go/src/udr/bin/* ./udr
37-
WORKDIR /omec-project/udr
44+
COPY --from=builder /go/src/udr/bin/* .

0 commit comments

Comments
 (0)