get.porter.sh/porter@v1.3.0/build/images/server/Dockerfile (about)

     1  FROM alpine:3 as builder
     2  ARG TARGETARCH
     3  WORKDIR /app/.porter
     4  
     5  RUN mkdir runtimes && \
     6    mkdir -p mixins/exec/runtimes
     7  
     8  # Install porter-api-server, agent, and the exec mixin, everything else
     9  COPY bin/dev/porter-api-server-linux-$TARGETARCH porter
    10  COPY bin/dev/agent-linux-$TARGETARCH agent
    11  COPY bin/mixins/exec/dev/exec-linux-$TARGETARCH mixins/exec/exec
    12  RUN ln -s /app/.porter/porter runtimes/porter-runtime && \
    13    ln -s /app/.porter/mixins/exec/exec mixins/exec/runtimes/exec-runtime
    14  
    15  # Copy the porter installation into a distroless container
    16  # Explicitly not using the nonroot tag because we don't want the user to exist so it is placed in the root group
    17  # This allows us to run with a random UID, and access a mounted docker socket (which is only accessible via the root group)
    18  FROM gcr.io/distroless/static
    19  WORKDIR /app
    20  COPY --from=builder --chown=65532:0 --chmod=770 /app/.porter /app/.porter
    21  ENV PATH "$PATH:/app/.porter"
    22  # This is where files that need to be copied into /app/.porter/ should be mounted
    23  VOLUME /porter-config
    24  ENV PORTER_HOME /app/.porter
    25  
    26  # Run as a nonroot user
    27  USER 65532
    28  ENTRYPOINT ["/app/.porter/agent"]