-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
5 changed files
with
179 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Copyright 2024 Louis Royer. All rights reserved. | ||
# Use of this source code is governed by a MIT-style license that can be | ||
# found in the LICENSE file. | ||
# SPDX-License-Identifier: MIT | ||
|
||
FROM golang:1.21 AS builder | ||
ARG COMMIT_GTP5GNL=548be7c8e3e46838a1833d324c4f2108d2e1db91 COMMIT=922281ba58b6ca42d73be218671c8feae3658420 | ||
RUN : ${COMMIT_GTP5GNL:? Missing build-arg COMMIT_GTP5GNL.} && go install \ | ||
github.com/free5gc/go-gtp5gnl/cmd/gogtp5g-tunnel@${COMMIT_GTP5GNL} | ||
RUN : ${COMMIT:? Missing build-arg COMMIT.} && go install \ | ||
-ldflags="-X github.com/free5gc/util/version.VERSION=https://github.com/louisroyer-docker/free5gc -X github.com/free5gc/util/version.BUILD_TIME= -X github.com/free5gc/util/version.COMMIT_HASH=${COMMIT} -X github.com/free5gc/util/version.COMMIT_TIME=" \ | ||
github.com/free5gc/go-upf/cmd@${COMMIT} | ||
|
||
|
||
FROM louisroyer/base-irit:latest | ||
|
||
LABEL maintainer="Louis Royer <[email protected]>" \ | ||
org.opencontainers.image.authors="Louis Royer <[email protected]>" \ | ||
org.opencontainers.image.source="https://github.com/louisroyer-docker/free5gc" | ||
|
||
# Used to disable caching of next steps, if not build since 1 day, | ||
# allowing to search and apply security upgrades | ||
ARG BUILD_DATE="" | ||
|
||
RUN apt-get update -q && DEBIAN_FRONTEND=non-interactive apt-get install -qy --no-install-recommends --no-install-suggests \ | ||
docker-setup \ | ||
&& apt-get upgrade -qy \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
COPY --from=builder /go/bin/gogtp5g-tunnel /usr/local/bin/gtp5g-tunnel | ||
COPY --from=builder /go/bin/cmd /usr/local/bin/upf | ||
COPY ./*.sh /usr/local/bin/ | ||
COPY ./template-upf.yaml /usr/local/share/free5gc/ | ||
|
||
ENV ROUTING_SCRIPT="docker-setup" \ | ||
ONESHOT="true" \ | ||
TEMPLATE_SCRIPT="template-script.sh" \ | ||
TEMPLATE_SCRIPT_ARGS="" \ | ||
CONFIG_FILE="/etc/free5gc/upf.yaml" \ | ||
CONFIG_TEMPLATE="/usr/local/share/free5gc/template-upf.yaml" | ||
|
||
ENTRYPOINT ["entrypoint.sh"] | ||
CMD ["--help"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/usr/bin/env bash | ||
# Copyright 2024 Louis Royer. All rights reserved. | ||
# Use of this source code is governed by a MIT-style license that can be | ||
# found in the LICENSE file. | ||
# SPDX-License-Identifier: MIT | ||
|
||
set -e | ||
savedargs=( "$@" ) | ||
config_opt=1 | ||
while [ $# -gt 0 ]; do | ||
if [[ $1 == "--config" || $1 == "-c" ]]; then | ||
config_opt=0 | ||
fi | ||
shift | ||
done | ||
set -- "${savedargs[@]}" | ||
|
||
if [[ -n "${CONFIG_TEMPLATE}" && -n "${CONFIG_FILE}" ]]; then | ||
if [ -n "${TEMPLATE_SCRIPT}" ]; then | ||
echo "[$(date --iso-8601=s)] Running ${TEMPLATE_SCRIPT}${TEMPLATE_SCRIPT_ARGS:+ }${TEMPLATE_SCRIPT_ARGS} for building ${CONFIG_FILE} from ${CONFIG_TEMPLATE}." > /dev/stderr | ||
"$TEMPLATE_SCRIPT" "$TEMPLATE_SCRIPT_ARGS" | ||
fi | ||
else | ||
config_opt=0 | ||
fi | ||
|
||
if [ -n "${ROUTING_SCRIPT}" ]; then | ||
"${ROUTING_SCRIPT}" | ||
fi | ||
|
||
if [[ $config_opt -eq 1 ]]; then | ||
exec upf --config "$CONFIG_FILE" "$@" | ||
else | ||
exec upf "$@" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#!/usr/bin/env bash | ||
# Copyright 2024 Louis Royer. All rights reserved. | ||
# Use of this source code is governed by a MIT-style license that can be | ||
# found in the LICENSE file. | ||
# SPDX-License-Identifier: MIT | ||
|
||
set -e | ||
mkdir -p "$(dirname "${CONFIG_FILE}")" | ||
|
||
if [ -z "$N4" ]; then | ||
echo "Missing mandatory environment variable (N4)." > /dev/stderr | ||
exit 1 | ||
fi | ||
if [ -z "$DNN_LIST" ]; then | ||
echo "Missing mandatory environment variable (DNN_LIST)." > /dev/stderr | ||
exit 1 | ||
fi | ||
if [ -z "$IF_LIST" ]; then | ||
echo "Missing mandatory environment variable (IF_LIST)." > /dev/stderr | ||
exit 1 | ||
fi | ||
|
||
IFS=$'\n' | ||
DNN_LIST_SUB="" | ||
for DNN in ${DNN_LIST}; do | ||
if [ -n "${DNN}" ]; then | ||
DNN_LIST_SUB="${DNN_LIST_SUB}\n ${DNN}" | ||
fi | ||
done | ||
IF_LIST_SUB="" | ||
for INTERFACE in ${IF_LIST}; do | ||
if [ -n "${INTERFACE}" ]; then | ||
IF_LIST_SUB="${IF_LIST_SUB}\n ${INTERFACE}" | ||
fi | ||
done | ||
|
||
|
||
awk \ | ||
-v N4="${N4}" \ | ||
-v DNN_LIST="${DNN_LIST_SUB}" \ | ||
-v IF_LIST="${IF_LIST_SUB}" \ | ||
'{ | ||
sub(/%N4/, N4); | ||
sub(/%DNN_LIST/, DNN_LIST); | ||
sub(/%IF_LIST/, IF_LIST); | ||
print; | ||
}' \ | ||
"${CONFIG_TEMPLATE}" > "${CONFIG_FILE}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
version: 1.0.3 | ||
description: UPF initial local configuration | ||
|
||
# The listen IP and nodeID of the N4 interface on this UPF (Can't set to 0.0.0.0) | ||
pfcp: | ||
addr: %N4 # IP addr for listening | ||
nodeID: %N4 # External IP or FQDN can be reached | ||
retransTimeout: 1s # retransmission timeout | ||
maxRetrans: 3 # the max number of retransmission | ||
|
||
gtpu: | ||
forwarder: gtp5g | ||
# The IP list of the N3/N9 interfaces on this UPF | ||
# If there are multiple connection, set addr to 0.0.0.0 or list all the addresses | ||
ifList: %IF_LIST | ||
dnnList: %DNN_LIST | ||
|
||
logger: # log output setting | ||
enable: true # true or false | ||
level: info # how detailed to output, value: trace, debug, info, warn, error, fatal, panic | ||
reportCaller: false # enable the caller report or not, value: true or false |