From 92460f811f846be61ea75d670dc4740a80f4c56f Mon Sep 17 00:00:00 2001 From: Andrea Mattia Date: Fri, 25 Feb 2022 17:38:15 +0100 Subject: [PATCH] Simplify sed commands in Dockerfile(s) Closes #740 Signed-off-by: Andrea Mattia --- Dockerfile | 4 ++-- Dockerfile.alpine | 4 ++-- Dockerfile.distroless | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index 45e8476d..07f16d42 100644 --- a/Dockerfile +++ b/Dockerfile @@ -54,8 +54,8 @@ ENV SFTPGO_HTTPD__STATIC_FILES_PATH=/usr/share/sftpgo/static ENV SFTPGO_HTTPD__OPENAPI_PATH=/usr/share/sftpgo/openapi # Modify the default configuration file -RUN sed -i "s|\"users_base_dir\": \"\",|\"users_base_dir\": \"/srv/sftpgo/data\",|" /etc/sftpgo/sftpgo.json && \ - sed -i "s|\"backups\"|\"/srv/sftpgo/backups\"|" /etc/sftpgo/sftpgo.json +RUN sed -i 's|"users_base_dir": "",|"users_base_dir": "/srv/sftpgo/data",|' /etc/sftpgo/sftpgo.json && \ + sed -i 's|"backups"|"/srv/sftpgo/backups"|' /etc/sftpgo/sftpgo.json RUN chown -R sftpgo:sftpgo /etc/sftpgo /srv/sftpgo && chown sftpgo:sftpgo /var/lib/sftpgo && chmod 700 /srv/sftpgo/backups diff --git a/Dockerfile.alpine b/Dockerfile.alpine index fc11adbb..e1cc2639 100644 --- a/Dockerfile.alpine +++ b/Dockerfile.alpine @@ -59,8 +59,8 @@ ENV SFTPGO_HTTPD__STATIC_FILES_PATH=/usr/share/sftpgo/static ENV SFTPGO_HTTPD__OPENAPI_PATH=/usr/share/sftpgo/openapi # Modify the default configuration file -RUN sed -i "s|\"users_base_dir\": \"\",|\"users_base_dir\": \"/srv/sftpgo/data\",|" /etc/sftpgo/sftpgo.json && \ - sed -i "s|\"backups\"|\"/srv/sftpgo/backups\"|" /etc/sftpgo/sftpgo.json +RUN sed -i 's|"users_base_dir": "",|"users_base_dir": "/srv/sftpgo/data",|' /etc/sftpgo/sftpgo.json && \ + sed -i 's|"backups"|"/srv/sftpgo/backups"|' /etc/sftpgo/sftpgo.json RUN chown -R sftpgo:sftpgo /etc/sftpgo /srv/sftpgo && chown sftpgo:sftpgo /var/lib/sftpgo && chmod 700 /srv/sftpgo/backups diff --git a/Dockerfile.distroless b/Dockerfile.distroless index 85de21e6..30d6ac01 100644 --- a/Dockerfile.distroless +++ b/Dockerfile.distroless @@ -24,9 +24,9 @@ RUN set -xe && \ go build $(if [ -n "${FEATURES}" ]; then echo "-tags ${FEATURES}"; fi) -trimpath -ldflags "-s -w -X github.com/drakkan/sftpgo/v2/version.commit=${COMMIT_SHA} -X github.com/drakkan/sftpgo/v2/version.date=`date -u +%FT%TZ`" -v -o sftpgo # Modify the default configuration file -RUN sed -i "s|\"users_base_dir\": \"\",|\"users_base_dir\": \"/srv/sftpgo/data\",|" sftpgo.json && \ - sed -i "s|\"backups\"|\"/srv/sftpgo/backups\"|" sftpgo.json && \ - sed -i "s|\"sqlite\"|\"bolt\"|" sftpgo.json +RUN sed -i 's|"users_base_dir": "",|"users_base_dir": "/srv/sftpgo/data",|' sftpgo.json && \ + sed -i 's|"backups"|"/srv/sftpgo/backups"|' sftpgo.json && \ + sed -i 's|"sqlite"|"bolt"|' sftpgo.json RUN apt-get update && apt-get install --no-install-recommends -y media-types && rm -rf /var/lib/apt/lists/*