Skip to content

Commit

Permalink
ci: move version calculation into a separate image layer
Browse files Browse the repository at this point in the history
  • Loading branch information
farioas committed Nov 1, 2024
1 parent 656fdfd commit e8a3698
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ ENV BUILD_NO_SERVER=true \
BUILD_NO_CHUNKS=true \
BUILD_MODULE=true \
YARN_CACHE_FOLDER=/root/web/.yarn \
NX_CACHE_DIRECTORY=/root/web/.nx \
NODE_ENV=production

WORKDIR /label-studio/web
Expand All @@ -20,14 +21,23 @@ COPY web/package.json .
COPY web/yarn.lock .
COPY web/tools tools
RUN --mount=type=cache,target=${YARN_CACHE_FOLDER},sharing=locked \
--mount=type=cache,target=${NX_CACHE_DIRECTORY},sharing=locked \
yarn install --prefer-offline --no-progress --pure-lockfile --frozen-lockfile --ignore-engines --non-interactive --production=false

COPY web .
COPY pyproject.toml ../pyproject.toml
RUN --mount=type=cache,target=${YARN_CACHE_FOLDER},sharing=locked \
--mount=type=cache,target=${NX_CACHE_DIRECTORY},sharing=locked \
yarn run build

################################ Stage: frontend-version-generator
FROM frontend-builder AS frontend-version-generator
RUN --mount=type=cache,target=${YARN_CACHE_FOLDER},sharing=locked \
--mount=type=cache,target=${NX_CACHE_DIRECTORY},sharing=locked \
--mount=type=bind,source=.git,target=../.git \
yarn run build && yarn version:libs
yarn version:libs

################################### Stage: prod
FROM ubuntu:22.04

ENV DEBIAN_FRONTEND=noninteractive \

Check warning on line 43 in Dockerfile

View workflow job for this annotation

GitHub Actions / Build / Docker image

Variables should be defined before their use

UndefinedVar: Usage of undefined variable '$HOME' More info: https://docs.docker.com/go/dockerfile/rule/undefined-var/
Expand Down Expand Up @@ -87,6 +97,9 @@ COPY --chown=1001:0 label_studio label_studio
COPY --chown=1001:0 deploy deploy

COPY --chown=1001:0 --from=frontend-builder /label-studio/web/dist $LS_DIR/web/dist
COPY --chown=1001:0 --from=frontend-version-generator /label-studio/web/dist/apps/labelstudio/version.json $LS_DIR/web/dist/apps/labelstudio/version.json
COPY --chown=1001:0 --from=frontend-version-generator /label-studio/web/dist/libs/editor/version.json $LS_DIR/web/dist/libs/editor/version.json
COPY --chown=1001:0 --from=frontend-version-generator /label-studio/web/dist/libs/datamanager/version.json $LS_DIR/web/dist/libs/datamanager/version.json

RUN python3 label_studio/manage.py collectstatic --no-input && \
chown -R 1001:0 $LS_DIR && \
Expand Down

0 comments on commit e8a3698

Please sign in to comment.