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

Docker image updates #74

Merged
merged 3 commits into from
Sep 18, 2020
Merged
Show file tree
Hide file tree
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
15 changes: 9 additions & 6 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
FROM composer:latest
FROM 10up/phpfpm

ARG WPSNAPSHOTS_ARCHIVE
ENV WPSNAPSHOTS_ARCHIVE $WPSNAPSHOTS_ARCHIVE

WORKDIR /opt/wpsnapshots

RUN wget -q -c ${WPSNAPSHOTS_ARCHIVE} -O - | tar -xz --strip 1 && \
RUN useradd wpsnapshots && \
mkdir -p /home/wpsnapshots && \
chown -R wpsnapshots:wpsnapshots /home/wpsnapshots && \
wget -q -c ${WPSNAPSHOTS_ARCHIVE} -O - | tar -xz --strip 1 && \
composer install --no-dev --no-progress && \
composer clear-cache
composer clear-cache && \
chown -R wpsnapshots:wpsnapshots /opt/wpsnapshots

WORKDIR /var/www/html
COPY entrypoint.sh /entrypoint.sh

ENTRYPOINT [ "/opt/wpsnapshots/bin/wpsnapshots" ]
CMD [ "help" ]
ENTRYPOINT [ "/entrypoint.sh" ]
12 changes: 12 additions & 0 deletions docker/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash

if [ -d /home/wpsnapshots/.wpsnapshots ]; then
www_uid=`stat -c "%u" /home/wpsnapshots/.wpsnapshots`
www_gid=`stat -c "%g" /home/wpsnapshots/.wpsnapshots`
if [ ! $www_uid -eq 0 ]; then
usermod -u $www_uid wpsnapshots 2> /dev/null
groupmod -g $www_gid wpsnapshots 2> /dev/null
fi
fi

exec su - wpsnapshots -c "cd /var/www/html; /opt/wpsnapshots/bin/wpsnapshots $*"