github.com/cozy/cozy-stack@v0.0.0-20240603063001-31110fa4cae1/scripts/docker/production/Dockerfile (about)

     1  # This Dockerfile should be used to create an environment to run cozy-stack
     2  # in a production environment.
     3  
     4  
     5  # Multi-stage image: this step builds cozy-stack
     6  FROM golang:1.22-bookworm as build
     7  WORKDIR /app
     8  
     9  # Use docker layer caching to avoid redownloading go modules if the code has
    10  # changed but not the dependencies.
    11  COPY go.mod .
    12  COPY go.sum .
    13  RUN go mod download
    14  
    15  # Build cozy-stack
    16  COPY . .
    17  RUN ./scripts/build.sh release ./cozy-stack
    18  
    19  
    20  # Multi-stage image: the main image
    21  FROM node:20-bookworm-slim
    22  
    23  ENV COUCHDB_PROTOCOL=http \
    24      COUCHDB_HOST=couchdb \
    25      COUCHDB_PORT=5984 \
    26      COUCHDB_USER=cozy \
    27      COUCHDB_PASSWORD=cozy
    28  
    29  ARG DEBIAN_FRONTEND=noninteractive
    30  
    31  COPY --from=build \
    32    /app/cozy-stack \
    33    /app/scripts/docker/production/docker-entrypoint.sh \
    34    /app/scripts/konnector-node-run.sh \
    35    /app/scripts/docker/production/wait-for-it.sh \
    36    /usr/local/bin/
    37  
    38  RUN set -eux \
    39      && apt-get update \
    40      && apt-get upgrade -y \
    41      && apt-get install -y --no-install-recommends \
    42        ca-certificates \
    43        curl \
    44        gosu \
    45        git \
    46        imagemagick \
    47        ghostscript \
    48        librsvg2-bin \
    49        fonts-lato \
    50        postfix \
    51        jq \
    52      && postconf inet_interfaces=loopback-only \
    53      && postconf mydestination='$myhostname, localhost.localdomain, localhost' \
    54      && sed -ie 's,^  \(<policy domain="coder" rights="none" pattern="PDF" />\)$,  <!-- \1 -->,g' /etc/ImageMagick-6/policy.xml \
    55      && gosu nobody true \
    56      && apt-get autoremove -y && apt-get clean \
    57      && rm -rf /tmp/* /var/tmp /var/lib/apt/lists/* /var/cache/apt \
    58      && chmod +x /usr/local/bin/*.sh
    59  
    60  WORKDIR /var/lib/cozy
    61  
    62  VOLUME /var/lib/cozy/data
    63  VOLUME /etc/cozy
    64  
    65  EXPOSE 6060 8080
    66  
    67  ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
    68  CMD ["cozy-stack","serve"]