move git clone into container

This commit is contained in:
Kegan Myers 2023-07-23 13:20:16 -05:00
parent 06384b9a19
commit 74e2f335be
2 changed files with 21 additions and 8 deletions

View file

@ -3,13 +3,22 @@ FROM registry.nrd.li/nrdli/akkoma-base:${AKKOMA_COMMIT}
ENV PROD_SECRET_FILE=/config/prod.secret.exs
ADD akkoma /opt/akkoma
ADD prod.exs /opt/akkoma/config/prod.exs
USER root
RUN mkdir /config && touch /config/prod.secret.exs && chown -R 1000:1000 /opt && chown -R 1000:1000 /config
RUN mkdir -p "$(dirname "${PROD_SECRET_FILE}")" && \
touch "${PROD_SECRET_FILE}" && \
chown -R 1000:1000 "$(dirname "${PROD_SECRET_FILE}")"
USER akkoma
RUN mix deps.get && mix compile
WORKDIR /opt
RUN rm -rf akkoma && \
git clone https://akkoma.dev/AkkomaGang/akkoma.git akkoma && \
git fetch --all && \
git checkout "${AKKOMA_COMMIT}"
ADD --chown=akkoma:akkoma prod.exs /opt/akkoma/config/prod.exs
WORKDIR /opt/akkoma
RUN mix deps.get
RUN mix compile
RUN mix pleroma.frontend install pleroma-fe --ref stable
RUN mix pleroma.frontend install admin-fe --ref stable

View file

@ -6,21 +6,25 @@ LOCAL_COMMIT=$(git rev-parse HEAD)
AKKOMA_BASE_IMAGE="registry.nrd.li/nrdli/akkoma-base:${AKKOMA_COMMIT}"
AKKOMA_FINAL_IMAGE="registry.nrd.li/nrdli/akkoma:${LOCAL_COMMIT}"
if [ ! -d akkoma ]; then
git clone https://akkoma.dev/AkkomaGang/akkoma.git akkoma
# clone akkoma source code
if [ -d akkoma ]; then
rm -rf akkoma
fi
git clone https://akkoma.dev/AkkomaGang/akkoma.git akkoma
pushd akkoma
git fetch --all
git checkout "${AKKOMA_COMMIT}"
if [ "$(git rev-parse HEAD)" != "${AKKOMA_COMMIT}" ]; then
exit 1
fi
# build and store base image
docker build \
-t "${AKKOMA_BASE_IMAGE}" \
.
docker push "${AKKOMA_BASE_IMAGE}"
popd
# run install steps for akkoma
docker build \
-t "${AKKOMA_FINAL_IMAGE}" \
--build-arg "AKKOMA_COMMIT=${AKKOMA_COMMIT}" \