Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wip: show how to build with local files #8

Conversation

maorleger
Copy link

No description provided.

FROM ${REGISTRY}node:${NODE_VERSION}-alpine as repo
RUN apk --no-cache add git
RUN git clone https://github.com/azure/azure-sdk-for-js --single-branch --branch main --depth 1 /azure-sdk-for-js
WORKDIR /app
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sets /app as the container's current working directory. /app is a pretty standard convention

RUN git clone https://github.com/azure/azure-sdk-for-js --single-branch --branch main --depth 1 /azure-sdk-for-js
WORKDIR /app

COPY . .
Copy link
Author

@maorleger maorleger Mar 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of cloning the whole repo, we can just copy the files over to the container - no git, etc required

This is also pretty common (caveat: probably not the best way to build apps because of caching, but we don't care about that here). This says: copy all files that are in the current directory (where Dockerfile lives) into the current directory (set by WORKDIR above).

Essentially copying everything in: sdk/identity/identity/test/integration/AzureKubernetes to /app which is what you want

RUN npm install
RUN npm install -g typescript
RUN tsc -p .
CMD ["node", "index"]
CMD [ "node", "dist/index.js" ]
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

matches tsconfig outdir

"@azure/storage-blob": "^12.17.0",
"tslib": "^1.10.0",
"ts-node": "10.9.2",
"dotenv": "^16.0.0"
Copy link
Author

@maorleger maorleger Mar 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was missing so I added it, although realistically dotenv is only needed when reading .env files and won't be needed in the deployed app (so you could get rid of it entirely)

"alwaysStrict": true,
"outDir": "./dist",
"rootDir": "./src"
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was missing so I added it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant