-
-
Notifications
You must be signed in to change notification settings - Fork 405
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
build: Manage Dockerfile with Dofigen #1014
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# This file is generated by Dofigen v2.0.0 | ||
# See https://github.com/lenra-io/dofigen | ||
|
||
node_modules | ||
/apps/docs | ||
/apps/screenshot-service | ||
/apps/web | ||
/packages/api | ||
/packages/integrations/vercel |
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,22 +1,51 @@ | ||
FROM oven/bun | ||
# syntax=docker/dockerfile:1.7 | ||
# This file is generated by Dofigen v2.0.0 | ||
# See https://github.com/lenra-io/dofigen | ||
|
||
WORKDIR /app | ||
# install | ||
FROM oven/bun@sha256:eb409bed239c3adff079a6b71283f151e802d66b99f643ba7a71e1be7d3da513 AS install | ||
WORKDIR /app/ | ||
RUN \ | ||
--mount=type=bind,target=package.json,source=package.json \ | ||
--mount=type=bind,target=apps/server/package.json,source=apps/server/package.json \ | ||
--mount=type=bind,target=packages/analytics/package.json,source=packages/analytics/package.json \ | ||
--mount=type=bind,target=packages/db/package.json,source=packages/db/package.json \ | ||
--mount=type=bind,target=packages/emails/package.json,source=packages/emails/package.json \ | ||
--mount=type=bind,target=packages/error/package.json,source=packages/error/package.json \ | ||
--mount=type=bind,target=packages/notifications/discord/package.json,source=packages/notifications/discord/package.json \ | ||
--mount=type=bind,target=packages/notifications/email/package.json,source=packages/notifications/email/package.json \ | ||
--mount=type=bind,target=packages/notifications/pagerduty/package.json,source=packages/notifications/pagerduty/package.json \ | ||
--mount=type=bind,target=packages/notifications/slack/package.json,source=packages/notifications/slack/package.json \ | ||
--mount=type=bind,target=packages/notifications/twillio-sms/package.json,source=packages/notifications/twillio-sms/package.json \ | ||
--mount=type=bind,target=packages/tinybird/package.json,source=packages/tinybird/package.json \ | ||
--mount=type=bind,target=packages/tracker/package.json,source=packages/tracker/package.json \ | ||
--mount=type=bind,target=packages/upstash/package.json,source=packages/upstash/package.json \ | ||
--mount=type=bind,target=packages/utils/package.json,source=packages/utils/package.json \ | ||
--mount=type=bind,target=packages/tsconfig/package.json,source=packages/tsconfig/package.json \ | ||
--mount=type=bind,target=packages/assertions/package.json,source=packages/assertions/package.json \ | ||
--mount=type=cache,target=/root/.bun/install/cache,sharing=locked \ | ||
bun install --production --ignore-scripts --frozen-lockfile --verbose | ||
|
||
# Copy project | ||
COPY . . | ||
|
||
# To keep the image small ;) | ||
RUN rm -rf /app/apps/docs | ||
RUN rm -rf /app/apps/screenshot-service | ||
RUN rm -rf /app/apps/web | ||
RUN rm -rf /app/packages/api | ||
RUN rm -rf /app/packages/integrations/vercel | ||
# Temp solution for bun | ||
RUN bun install --ignore-scripts | ||
# build | ||
FROM oven/bun@sha256:eb409bed239c3adff079a6b71283f151e802d66b99f643ba7a71e1be7d3da513 AS build | ||
WORKDIR /app/apps/server | ||
|
||
# Compile the TypeScript application | ||
COPY \ | ||
--link \ | ||
"." "/app/" | ||
COPY \ | ||
--from=install \ | ||
--link \ | ||
"/app/node_modules" "/app/node_modules" | ||
RUN bun build --compile --sourcemap src/index.ts --outfile=app | ||
|
||
# runtime | ||
FROM debian@sha256:00558f781b91e90469812bad32002f311ab26ef241b4a1996f6600680ec82f5c AS runtime | ||
COPY \ | ||
--from=build \ | ||
--chown=1000:1000 \ | ||
--chmod=555 \ | ||
--link \ | ||
"/app/apps/server/app" "/bin/" | ||
USER 1000:1000 | ||
EXPOSE 3000 | ||
CMD ["./app"] | ||
ENTRYPOINT ["/bin/app"] |
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 |
---|---|---|
@@ -0,0 +1,95 @@ | ||
effective: | | ||
ignore: | ||
- node_modules | ||
- /apps/docs | ||
- /apps/screenshot-service | ||
- /apps/web | ||
- /packages/api | ||
- /packages/integrations/vercel | ||
builders: | ||
build: | ||
fromImage: | ||
path: oven/bun | ||
digest: sha256:eb409bed239c3adff079a6b71283f151e802d66b99f643ba7a71e1be7d3da513 | ||
workdir: /app/apps/server | ||
copy: | ||
- paths: | ||
- . | ||
target: /app/ | ||
- fromBuilder: install | ||
paths: | ||
- /app/node_modules | ||
target: /app/node_modules | ||
run: | ||
- bun build --compile --sourcemap src/index.ts --outfile=app | ||
install: | ||
fromImage: | ||
path: oven/bun | ||
digest: sha256:eb409bed239c3adff079a6b71283f151e802d66b99f643ba7a71e1be7d3da513 | ||
workdir: /app/ | ||
run: | ||
- bun install --production --ignore-scripts --frozen-lockfile --verbose | ||
cache: | ||
- target: /root/.bun/install/cache | ||
bind: | ||
- target: package.json | ||
source: package.json | ||
- target: apps/server/package.json | ||
source: apps/server/package.json | ||
- target: packages/analytics/package.json | ||
source: packages/analytics/package.json | ||
- target: packages/db/package.json | ||
source: packages/db/package.json | ||
- target: packages/emails/package.json | ||
source: packages/emails/package.json | ||
- target: packages/error/package.json | ||
source: packages/error/package.json | ||
- target: packages/notifications/discord/package.json | ||
source: packages/notifications/discord/package.json | ||
- target: packages/notifications/email/package.json | ||
source: packages/notifications/email/package.json | ||
- target: packages/notifications/pagerduty/package.json | ||
source: packages/notifications/pagerduty/package.json | ||
- target: packages/notifications/slack/package.json | ||
source: packages/notifications/slack/package.json | ||
- target: packages/notifications/twillio-sms/package.json | ||
source: packages/notifications/twillio-sms/package.json | ||
- target: packages/tinybird/package.json | ||
source: packages/tinybird/package.json | ||
- target: packages/tracker/package.json | ||
source: packages/tracker/package.json | ||
- target: packages/upstash/package.json | ||
source: packages/upstash/package.json | ||
- target: packages/utils/package.json | ||
source: packages/utils/package.json | ||
- target: packages/tsconfig/package.json | ||
source: packages/tsconfig/package.json | ||
- target: packages/assertions/package.json | ||
source: packages/assertions/package.json | ||
fromImage: | ||
path: debian | ||
digest: sha256:00558f781b91e90469812bad32002f311ab26ef241b4a1996f6600680ec82f5c | ||
copy: | ||
- fromBuilder: build | ||
paths: | ||
- /app/apps/server/app | ||
target: /bin/ | ||
chmod: '555' | ||
entrypoint: | ||
- /bin/app | ||
expose: | ||
- port: 3000 | ||
images: | ||
registry.hub.docker.com:443: | ||
oven: | ||
bun: | ||
latest: | ||
digest: sha256:eb409bed239c3adff079a6b71283f151e802d66b99f643ba7a71e1be7d3da513 | ||
library: | ||
debian: | ||
bullseye-slim: | ||
digest: sha256:00558f781b91e90469812bad32002f311ab26ef241b4a1996f6600680ec82f5c | ||
resources: | ||
dofigen.yml: | ||
hash: adf3f9674023b48f97b9d48996067d36db5da23a2ee73685c1d85079e1328320 | ||
content: "ignore:\n - node_modules\n - /apps/docs\n - /apps/screenshot-service\n - /apps/web\n - /packages/api\n - /packages/integrations/vercel\nbuilders:\n install:\n fromImage: oven/bun\n workdir: /app/\n # Copy project\n bind:\n - package.json\n - apps/server/package.json\n - packages/analytics/package.json\n - packages/db/package.json\n - packages/emails/package.json\n - packages/error/package.json\n - packages/notifications/discord/package.json\n - packages/notifications/email/package.json\n - packages/notifications/pagerduty/package.json\n - packages/notifications/slack/package.json\n - packages/notifications/twillio-sms/package.json\n - packages/tinybird/package.json\n - packages/tracker/package.json\n - packages/upstash/package.json\n - packages/utils/package.json\n - packages/tsconfig/package.json\n - packages/assertions/package.json\n # Install dependencies\n run: bun install --production --ignore-scripts --frozen-lockfile --verbose\n cache:\n - /root/.bun/install/cache\n build:\n fromImage: oven/bun\n workdir: /app/apps/server\n copy: \n - . /app/\n - fromBuilder: install\n source: /app/node_modules\n target: /app/node_modules\n # Compile the TypeScript application\n run: bun build --compile --sourcemap src/index.ts --outfile=app\nfromImage: debian:bullseye-slim\ncopy:\n - fromBuilder: build\n source: /app/apps/server/app\n target: /bin/\n chmod: \"555\"\nexpose: 3000\nentrypoint: /bin/app\n" |
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 |
---|---|---|
@@ -0,0 +1,52 @@ | ||
ignore: | ||
- node_modules | ||
- /apps/docs | ||
- /apps/screenshot-service | ||
- /apps/web | ||
- /packages/api | ||
- /packages/integrations/vercel | ||
builders: | ||
install: | ||
fromImage: oven/bun | ||
workdir: /app/ | ||
# Copy project | ||
bind: | ||
- package.json | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I m ashamed by that part our monorepo is 😱 |
||
- apps/server/package.json | ||
- packages/analytics/package.json | ||
- packages/db/package.json | ||
- packages/emails/package.json | ||
- packages/error/package.json | ||
- packages/notifications/discord/package.json | ||
- packages/notifications/email/package.json | ||
- packages/notifications/pagerduty/package.json | ||
- packages/notifications/slack/package.json | ||
- packages/notifications/twillio-sms/package.json | ||
- packages/tinybird/package.json | ||
- packages/tracker/package.json | ||
- packages/upstash/package.json | ||
- packages/utils/package.json | ||
- packages/tsconfig/package.json | ||
- packages/assertions/package.json | ||
# Install dependencies | ||
run: bun install --production --ignore-scripts --frozen-lockfile --verbose | ||
cache: | ||
- /root/.bun/install/cache | ||
build: | ||
fromImage: oven/bun | ||
workdir: /app/apps/server | ||
copy: | ||
- . /app/ | ||
- fromBuilder: install | ||
source: /app/node_modules | ||
target: /app/node_modules | ||
# Compile the TypeScript application | ||
run: bun build --compile --sourcemap src/index.ts --outfile=app | ||
fromImage: debian:bullseye-slim | ||
copy: | ||
- fromBuilder: build | ||
source: /app/apps/server/app | ||
target: /bin/ | ||
chmod: "555" | ||
expose: 3000 | ||
entrypoint: /bin/app |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@taorepoara do we really need the hash?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The hash gives you the control on the
FROM
images. Dofigen does it by default, but I'll add a flag to avoid that: lenra-io/dofigen#278