2021-08-25 10:00:20 +08:00
# This dockerfile is used to build up from a base image to create an image a cache.tar file containing the results of running "prepare.sh".
2020-10-08 22:27:19 +08:00
# Other image contents: https://github.com/microsoft/vscode-dev-containers/blob/master/repository-containers/images/github.com/microsoft/vscode/.devcontainer/base.Dockerfile
2021-08-25 10:00:20 +08:00
# This first stage generates cache.tar
2021-08-25 09:31:47 +08:00
FROM mcr.microsoft.com/vscode/devcontainers/repos/microsoft/vscode:dev as cache
2020-10-08 22:27:19 +08:00
ARG USERNAME=node
2022-03-17 06:32:46 +08:00
ARG CACHE_FOLDER="/home/${USERNAME}/.devcontainer-cache"
2020-10-08 22:27:19 +08:00
COPY --chown=${USERNAME}:${USERNAME} . /repo-source-tmp/
2022-03-17 02:07:02 +08:00
RUN mkdir -p ${CACHE_FOLDER} && chown ${USERNAME} ${CACHE_FOLDER} /repo-source-tmp \
2020-10-08 22:27:19 +08:00
&& su ${USERNAME} -c "\
2022-03-17 06:40:07 +08:00
cd /repo-source-tmp \
2023-01-20 22:27:07 +08:00
&& .devcontainer/prebuilt/cache/before-cache.sh . ${CACHE_FOLDER} \
&& .devcontainer/prebuilt/prepare.sh . ${CACHE_FOLDER} \
&& .devcontainer/prebuilt/cache/cache-diff.sh . ${CACHE_FOLDER}"
2021-08-25 09:31:47 +08:00
2021-08-25 10:00:20 +08:00
# This second stage starts fresh and just copies in cache.tar from the previous stage. The related
# devcontainer.json file is then setup to have postCreateCommand fire restore-diff.sh to expand it.
2021-08-25 09:31:47 +08:00
FROM mcr.microsoft.com/vscode/devcontainers/repos/microsoft/vscode:dev as dev-container
ARG USERNAME=node
2022-03-17 06:32:46 +08:00
ARG CACHE_FOLDER="/home/${USERNAME}/.devcontainer-cache"
2022-03-17 08:29:14 +08:00
RUN mkdir -p "${CACHE_FOLDER}" \
&& chown "${USERNAME}:${USERNAME}" "${CACHE_FOLDER}" \
&& su ${USERNAME} -c "git config --global codespaces-theme.hide-status 1"
2021-08-25 09:31:47 +08:00
COPY --from=cache ${CACHE_FOLDER}/cache.tar ${CACHE_FOLDER}/