Skip to content
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

Refactor docker image #78

Merged
merged 1 commit into from
Mar 4, 2024
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
33 changes: 21 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# SPDX-FileCopyrightText: 2021 Open Networking Foundation <info@opennetworking.org>
# SPDX-FileCopyrightText: 2024 Intel Corporation
#
# SPDX-License-Identifier: Apache-2.0
#
Expand All @@ -7,15 +8,23 @@ FROM golang:1.22.0-bookworm AS builder

LABEL maintainer="ONF <omec-dev@opennetworking.org>"

RUN apt-get update && apt-get -y install apt-transport-https ca-certificates
RUN apt-get update && apt-get -y install gcc cmake autoconf libtool pkg-config libmnl-dev libyaml-dev
RUN apt-get clean
RUN apt-get update && \
apt-get -y install --no-install-recommends \
apt-transport-https \
ca-certificates \
gcc \
cmake \
autoconf \
libtool \
pkg-config \
libmnl-dev \
libyaml-dev && \
apt-get clean

WORKDIR $GOPATH/src/pcf

RUN cd $GOPATH/src && mkdir -p pcf
COPY . $GOPATH/src/pcf
RUN cd $GOPATH/src/pcf \
&& make all
COPY . .
RUN make all

FROM alpine:3.19 as pcf

Expand All @@ -25,12 +34,12 @@ LABEL description="ONF open source 5G Core Network" \
ARG DEBUG_TOOLS

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

# Set working dir
WORKDIR /free5gc
RUN mkdir -p pcf/
WORKDIR /free5gc/pcf

# Copy executable and default certs
COPY --from=builder /go/src/pcf/bin/* ./pcf
WORKDIR /free5gc/pcf
COPY --from=builder /go/src/pcf/bin/* .
Loading