chore: append +neko:xxx to version in docker image

This commit is contained in:
sup39 2023-11-02 18:38:03 +09:00 committed by naskya
parent 22284e0fda
commit 290f98ae8b
Signed by: naskya
GPG key ID: 164DFF24E2D40139
2 changed files with 9 additions and 0 deletions

View file

@ -40,5 +40,7 @@ packages/backend/assets/instance.css
# dockerignore custom # dockerignore custom
.git .git
!.git/HEAD
!.git/refs
Dockerfile Dockerfile
docker-compose.yml docker-compose.yml

View file

@ -42,6 +42,11 @@ RUN pnpm run --filter native-utils build
# Copy in the rest of the files to compile # Copy in the rest of the files to compile
COPY . ./ COPY . ./
# Create dummy .git/objects directory for `git rev-parse`
RUN mkdir .git/objects
# Write version info
RUN bash -c 'NEW_COMMIT=$(git rev-parse --short HEAD) && sed -i -r "s/\"version\": \"([^+]+).*\",$/\"version\": \"\\1+neko:${NEW_COMMIT:0:7}\",/" package.json'
# Compile
RUN env NODE_ENV=production sh -c "pnpm run --filter '!native-utils' build && pnpm run gulp" RUN env NODE_ENV=production sh -c "pnpm run --filter '!native-utils' build && pnpm run gulp"
# Trim down the dependencies to only those for production # Trim down the dependencies to only those for production
@ -55,6 +60,8 @@ WORKDIR /firefish
RUN apt-get update && apt-get install -y libvips-dev zip unzip tini ffmpeg RUN apt-get update && apt-get install -y libvips-dev zip unzip tini ffmpeg
COPY . ./ COPY . ./
# Remove .git
RUN rm -rf .git
COPY --from=build /firefish/packages/megalodon /firefish/packages/megalodon COPY --from=build /firefish/packages/megalodon /firefish/packages/megalodon