Skip to content
Snippets Groups Projects
Commit 155d7c4a authored by Moul's avatar Moul
Browse files

[wip] #388: Dockerfile into two steps

parent 824b894e
No related branches found
No related tags found
No related merge requests found
FROM registry.duniter.org/docker/python3/poetry/3.9:latest
# ------------------------------------------------------------------------------
# Build Stage
# ------------------------------------------------------------------------------
FROM registry.duniter.org/docker/python3/poetry/3.9:latest as build
WORKDIR /silkaj
RUN ls && ls silkaj
# Copy source tree
COPY ./ ./
# Install Silkaj
RUN poetry install
# ------------------------------------------------------------------------------
# Final Stage
# ------------------------------------------------------------------------------
FROM registry.duniter.org/docker/python3/poetry/3.9:latest
# Create silkaj group and user
RUN addgroup -S -g 1111 silkaj && \
adduser -SD -h /silkaj -G silkaj -u 1111 silkaj
# Copy the build artifact from the build stage
COPY --from=build --chown=silkaj:silkaj /silkaj /silkaj
# Set up alias to directly get silkaj command
# https://stackoverflow.com/a/3638886
RUN printf '#!/bin/bash\npoetry run silkaj "$@"' > /usr/bin/silkaj && \
chmod +x /usr/bin/silkaj
chmod +x /usr/bin/silkaj && \
chown silkaj: /usr/bin/silkaj
# Use silkaj user
USER silkaj
WORKDIR /silkaj
CMD ["/usr/bin/silkaj"]
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment