Skip to content

Commit

Permalink
chore: add yarnrc to dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
nihalgonsalves committed Nov 27, 2023
1 parent c52d89f commit 5f53686
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 7 deletions.
7 changes: 6 additions & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
FROM mcr.microsoft.com/devcontainers/javascript-node:20

RUN corepack enable
SHELL ["/bin/bash", "-o", "pipefail", "-c"]

RUN curl -fsSL https://get.docker.com | sh && rm -rf /var/lib/apt/lists/*
RUN usermod -aG docker node && newgrp docker

RUN corepack enable
8 changes: 8 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@
"extensions": ["esbenp.prettier-vscode", "dbaeumer.vscode-eslint"]
}
},
"mounts": [
{
"source": "/var/run/docker.sock",
"target": "/var/run/docker.sock",
"type": "bind"
}
],
"onCreateCommand": "yarn install",
"postCreateCommand": "sudo chown root:docker /var/run/docker.sock",
"remoteUser": "node"
}
14 changes: 8 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,25 @@ FROM node:20-slim as builder

WORKDIR /usr/src/app

ADD package.json .
ADD yarn.lock .
COPY ./package.json ./
COPY ./yarn.lock ./
COPY ./.yarnrc.yml ./

RUN corepack enable
RUN yarn install --immutable

ADD tsconfig.json .
ADD src/ ./src/
COPY tsconfig.json .
COPY src/ ./src/

RUN yarn build

FROM node:20-slim

WORKDIR /usr/src/app

ADD package.json .
ADD yarn.lock .
COPY ./package.json ./
COPY ./yarn.lock ./
COPY ./.yarnrc.yml ./

RUN corepack enable
RUN yarn install --immutable
Expand Down

0 comments on commit 5f53686

Please sign in to comment.