From 28480028a31129cbd990b15f31142056e50dd02a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20=C5=9Awi=C4=99cki?= Date: Tue, 6 Sep 2022 12:12:54 +0200 Subject: [PATCH] chore(docker): Simplify the main Dockerfile MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The main Dockerfile is meant to be used by many automatic tools such as automatic cloud runners, scanners etc. Thsi file must be kept minimal to minimize build time and provide an easy to modify example dockerfile for immudb. Signed-off-by: Bartłomiej Święcki --- Dockerfile | 59 ++++++++++++++---------------------------------------- 1 file changed, 15 insertions(+), 44 deletions(-) diff --git a/Dockerfile b/Dockerfile index 0d643e499a..a35045d02a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,17 @@ +# Copyright 2022 Codenotary Inc. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + FROM golang:1.18 as build WORKDIR /src COPY go.mod go.sum /src/ @@ -7,50 +21,7 @@ RUN rm -rf /src/webconsole/dist RUN GOOS=linux GOARCH=amd64 WEBCONSOLE=default make immuadmin-static immudb-static RUN mkdir /empty -FROM debian:bullseye-slim as bullseye-slim -LABEL org.opencontainers.image.authors="Codenotary Inc. " - -COPY --from=build /src/immudb /usr/sbin/immudb -COPY --from=build /src/immuadmin /usr/local/bin/immuadmin -COPY --from=build "/etc/ssl/certs/ca-certificates.crt" "/etc/ssl/certs/ca-certificates.crt" - -ARG IMMU_UID="3322" -ARG IMMU_GID="3322" - -ENV IMMUDB_HOME="/usr/share/immudb" \ - IMMUDB_DIR="/var/lib/immudb" \ - IMMUDB_ADDRESS="0.0.0.0" \ - IMMUDB_PORT="3322" \ - IMMUDB_PIDFILE="" \ - IMMUDB_LOGFILE="" \ - IMMUDB_MTLS="false" \ - IMMUDB_AUTH="true" \ - IMMUDB_DETACHED="false" \ - IMMUDB_DEVMODE="true" \ - IMMUDB_MAINTENANCE="false" \ - IMMUDB_ADMIN_PASSWORD="immudb" \ - IMMUDB_PGSQL_SERVER="true" \ - IMMUADMIN_TOKENFILE="/var/lib/immudb/admin_token" - -RUN addgroup --system --gid $IMMU_GID immu && \ - adduser --system --uid $IMMU_UID --no-create-home --ingroup immu immu && \ - mkdir -p "$IMMUDB_HOME" && \ - mkdir -p "$IMMUDB_DIR" && \ - chown -R immu:immu "$IMMUDB_HOME" "$IMMUDB_DIR" && \ - chmod -R 777 "$IMMUDB_HOME" "$IMMUDB_DIR" && \ - chmod +x /usr/sbin/immudb /usr/local/bin/immuadmin - -EXPOSE 3322 -EXPOSE 9497 -EXPOSE 8080 -EXPOSE 5432 - -HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 CMD [ "/usr/local/bin/immuadmin", "status" ] -USER immu -ENTRYPOINT ["/usr/sbin/immudb"] - - -FROM scratch as scratch +FROM scratch LABEL org.opencontainers.image.authors="Codenotary Inc. " ARG IMMU_UID="3322"