Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix permission issue in docker all in one image #4770

Merged
merged 1 commit into from
Nov 11, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 12 additions & 13 deletions deploy/Dockerfile.all-in-one
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,21 @@ RUN CERTS_PATH=/home/stratos/dev-certs ./generate_cert.sh
FROM splatform/stratos-bk-base:leap15_2
ARG CANARY_BUILD

COPY --from=jetstream-builder /home/stratos/deploy/db /src/deploy/db
COPY --from=jetstream-builder /home/stratos/dev-certs /srv/dev-certs
COPY --from=jetstream-builder /home/stratos/ui /srv/ui
COPY --from=jetstream-builder /home/stratos/jetstream /srv/jetstream
# Add a jetstream user so we don't run as root
RUN useradd -M -U -u 2000 jetstream
RUN usermod -aG users jetstream

# Ensure that the /srv folder is in the users group so that the jetstream user can write to it
RUN mkdir -p /srv && chgrp users /srv && chmod 775 /srv

COPY --chown=jetstream:users --from=jetstream-builder /home/stratos/dev-certs /srv/dev-certs
COPY --chown=jetstream:users --from=jetstream-builder /home/stratos/ui /srv/ui
COPY --chown=jetstream:users --from=jetstream-builder /home/stratos/jetstream /srv/jetstream
RUN chmod +x /srv/jetstream
COPY --from=jetstream-builder /home/stratos/config.properties /srv/config.properties
COPY --chown=jetstream:users --from=jetstream-builder /home/stratos/config.properties /srv/config.properties

# User Invite templates
COPY --from=jetstream-builder /home/stratos/src/jetstream/templates /srv/templates
COPY --chown=jetstream:users --from=jetstream-builder /home/stratos/src/jetstream/templates /srv/templates

# Enable persistence features if canary build flag is set
RUN if [ "x$CANARY_BUILD" != "x" ] ; then printf "\nFORCE_ENABLE_PERSISTENCE_FEATURES=true\n" >> /srv/config.properties ; fi
Expand All @@ -41,13 +47,6 @@ RUN if [ "x$CANARY_BUILD" != "x" ] ; then printf "\nENABLE_TECH_PREVIEW=true\n"

EXPOSE 5443

# Add a jetstream user so we don't run as root
RUN useradd -M -U -u 2000 jetstream
RUN usermod -aG users jetstream

# Ensure that the /srv folder is in the users group so that the jetstream user can write to it
RUN chgrp users /srv && chmod 775 /srv

USER jetstream

ENTRYPOINT ["./jetstream"]