blob: e3f1db3eea3459580972fb1861d91aeb809f28a3 [file] [log] [blame]
garciadeblas83775ba2025-07-23 18:35:24 +02001#######################################################################################
2# Copyright ETSI Contributors and Others.
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
13# implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16#######################################################################################
17
18FROM alpine:3.21.3
19# FROM ghcr.io/nushell/nushell:0.104.0-alpine
20
21ARG NUSHELL_VERSION=0.104.1
22
23
24# Install Nushell for Alpine
25#-----------------------------------------------------
26#
27RUN echo '/usr/bin/nu' >> /etc/shells \
28 && adduser -D -s /usr/bin/nu nushell \
29 && mkdir -p /home/nushell/.config/nushell/ \
30 && cd /tmp \
31 && wget "https://github.com/nushell/nushell/releases/download/${NUSHELL_VERSION}/nu-${NUSHELL_VERSION}-x86_64-unknown-linux-musl.tar.gz" \
32 && mkdir nu-${NUSHELL_VERSION} && tar xvf nu-*.tar.gz --directory=nu-${NUSHELL_VERSION} \
33 && cp -aR nu-${NUSHELL_VERSION}/**/* /usr/bin/ \
34 # Setup default config file for nushell
35 && cd /home/nushell/.config/nushell \
36 && chmod +x /usr/bin/nu \
37 && chown -R nushell:nushell /home/nushell/.config/nushell \
38 # Reset Nushell config to default
39 && su -c 'config reset -w' nushell \
40 && ls /usr/bin/nu_plugin* \
41 | xargs -I{} su -c 'plugin add {}' nushell \
42 && rm -rf /tmp/*
43#
44#-----------------------------------------------------
45
46# Install dependencies
47RUN apk add --no-cache \
48 age \
49 envsubst \
50 git \
51 kubectl \
52 sops && \
53 # Install dependencies unavailable at Alpine repos
54 wget https://github.com/kptdev/kpt/releases/download/v1.0.0-beta.57/kpt_linux_amd64 -O kpt && \
55 chmod +x kpt && \
56 mv kpt /usr/local/bin/ && \
57 # Create default folders and files
58 mkdir -p /repos && \
59 chmod 755 /repos && \
60 mkdir -p /model/parameters/clear && \
61 mkdir -p /model/parameters/secret && \
62 chmod -R 755 /model && \
63 echo '{}' > /model/app_instance_model.yaml && \
64 echo '{}' > /model/parameters/clear/environment.yaml && \
65 echo '{}' > /model/parameters/secret/environment.yaml
66
67
68# Become the standard user
69USER nushell
70WORKDIR /app
71
72# Add libraries and helper scripts
73COPY --chown=nushell:nushell scripts /app/scripts
74COPY --chown=nushell:nushell krm /app/osm/krm
75COPY --chown=nushell:nushell operations /app/osm/operations
76
77# Add the entrypoint and default command
78ENTRYPOINT ["/bin/sh", "/app/scripts/entrypoint.sh"]
79
80CMD ["nu"]