-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #197 from walt-id/fix-docker-cherrypick
Fix Docker build
- Loading branch information
Showing
10 changed files
with
68 additions
and
614 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
*/build | ||
*/.nuxt | ||
*/node_modules | ||
.gradle | ||
.idea | ||
.run | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,40 @@ | ||
# BUILD | ||
FROM docker.io/oven/bun:1 as buildstage | ||
|
||
COPY waltid-web-wallet /build | ||
# use the official Bun image | ||
# see all versions at https://hub.docker.com/r/oven/bun/tags | ||
FROM oven/bun:1 as base | ||
WORKDIR /app | ||
|
||
WORKDIR /build | ||
RUN bun install | ||
# install dependencies into temp directory | ||
# this will cache them and speed up future builds | ||
FROM base AS install | ||
RUN mkdir -p /temp/dev | ||
COPY package.json bun.lockb /temp/dev/ | ||
RUN cd /temp/dev && bun install --frozen-lockfile | ||
|
||
RUN bun run build | ||
# install with --production (exclude devDependencies) | ||
RUN mkdir -p /temp/prod | ||
COPY package.json bun.lockb /temp/prod/ | ||
RUN cd /temp/prod && bun install --frozen-lockfile --production | ||
|
||
# RUN | ||
FROM docker.io/node:alpine | ||
COPY --from=buildstage /build/.output/ /app | ||
# copy node_modules from temp directory | ||
# then copy all (non-ignored) project files into the image | ||
FROM base AS prerelease | ||
COPY --from=install /temp/dev/node_modules node_modules | ||
COPY . . | ||
|
||
WORKDIR /app | ||
# [optional] tests & build | ||
ENV NODE_ENV=production | ||
RUN bun test | ||
RUN bun run build | ||
|
||
EXPOSE 7101 | ||
ENTRYPOINT node server/index.mjs | ||
# copy production dependencies and source code into final image | ||
FROM base AS release | ||
COPY --from=install /temp/prod/node_modules node_modules | ||
COPY --from=prerelease /app/.output/ . | ||
COPY --from=prerelease /app/package.json . | ||
|
||
# run the app | ||
RUN chmod -R a+r . | ||
USER bun | ||
EXPOSE 7101/tcp | ||
ENV PORT=7101 | ||
ENTRYPOINT [ "bun", "run", "server/index.mjs" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.