mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-24 18:49:00 +01:00
Cleanup, use multi-stage Dockerfile to minimize size
This commit is contained in:
13
.devcontainer/cache/cache.Dockerfile
vendored
13
.devcontainer/cache/cache.Dockerfile
vendored
@@ -1,7 +1,8 @@
|
||||
# This dockerfile is used to build up from a base image to create an image with cached results of running "prepare.sh".
|
||||
# Other image contents: https://github.com/microsoft/vscode-dev-containers/blob/master/repository-containers/images/github.com/microsoft/vscode/.devcontainer/base.Dockerfile
|
||||
FROM mcr.microsoft.com/vscode/devcontainers/repos/microsoft/vscode:dev
|
||||
|
||||
# First stage generates the cache tar
|
||||
FROM mcr.microsoft.com/vscode/devcontainers/repos/microsoft/vscode:dev as cache
|
||||
ARG USERNAME=node
|
||||
COPY --chown=${USERNAME}:${USERNAME} . /repo-source-tmp/
|
||||
RUN mkdir /usr/local/etc/devcontainer-cache \
|
||||
@@ -10,5 +11,11 @@ RUN mkdir /usr/local/etc/devcontainer-cache \
|
||||
cd /repo-source-tmp \
|
||||
&& .devcontainer/cache/before-cache.sh \
|
||||
&& .devcontainer/prepare.sh \
|
||||
&& .devcontainer/cache/cache-diff.sh" \
|
||||
&& rm -rf /repo-source-tmp
|
||||
&& .devcontainer/cache/cache-diff.sh"
|
||||
|
||||
# Second stage is the acual output that includes only the tar - restore-diff.sh is then fired on postCreateCommand to expand it
|
||||
FROM mcr.microsoft.com/vscode/devcontainers/repos/microsoft/vscode:dev as dev-container
|
||||
ARG USERNAME=node
|
||||
ARG CACHE_FOLDER="/usr/local/etc/devcontainer-cache"
|
||||
RUN mkdir -p "${CACHE_FOLDER}" && chown "${USERNAME}:${USERNAME}" "${CACHE_FOLDER}"
|
||||
COPY --from=cache ${CACHE_FOLDER}/cache.tar ${CACHE_FOLDER}/
|
||||
|
||||
Reference in New Issue
Block a user