-
-
Notifications
You must be signed in to change notification settings - Fork 405
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: Manage Dockerfile with Dofigen
- Loading branch information
1 parent
99d718a
commit cd438e7
Showing
4 changed files
with
121 additions
and
16 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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# This file is generated by Dofigen v2.0.0-rc.3 | ||
# 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,31 @@ | ||
FROM oven/bun | ||
# syntax=docker/dockerfile:1.7 | ||
# This file is generated by Dofigen v2.0.0-rc.3 | ||
# See https://github.com/lenra-io/dofigen | ||
|
||
WORKDIR /app | ||
|
||
# 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 | ||
# install | ||
FROM oven/bun@sha256:eb409bed239c3adff079a6b71283f151e802d66b99f643ba7a71e1be7d3da513 AS install | ||
WORKDIR /app/apps/server | ||
COPY \ | ||
--link \ | ||
"." "/app/" | ||
USER 0:0 | ||
RUN \ | ||
--mount=type=cache,target=/root/.bun/install/cache,uid=0,gid=0 \ | ||
bun install --ignore-scripts --frozen-lockfile | ||
|
||
# Compile the TypeScript application | ||
# build | ||
FROM install AS build | ||
USER 0:0 | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
effective: | | ||
ignore: | ||
- node_modules | ||
- /apps/docs | ||
- /apps/screenshot-service | ||
- /apps/web | ||
- /packages/api | ||
- /packages/integrations/vercel | ||
builders: | ||
install: | ||
fromImage: | ||
path: oven/bun | ||
digest: sha256:eb409bed239c3adff079a6b71283f151e802d66b99f643ba7a71e1be7d3da513 | ||
workdir: /app/apps/server | ||
copy: | ||
- paths: | ||
- . | ||
target: /app/ | ||
root: | ||
run: | ||
- bun install --ignore-scripts --frozen-lockfile | ||
cache: | ||
- target: /root/.bun/install/cache | ||
build: | ||
fromBuilder: install | ||
root: | ||
run: | ||
- bun build --compile --sourcemap src/index.ts --outfile=app | ||
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: 5f7db31b90debbcf5755635a68b05d42eba53d65243e86a91ff9fccde15a6089 | ||
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/apps/server\n # Copy project\n copy: . /app/\n # Install dependencies\n root:\n run: \n - bun install --ignore-scripts --frozen-lockfile\n cache:\n - /root/.bun/install/cache\n build:\n fromBuilder: install\n # Compile the TypeScript application\n root:\n run: bun build --compile --sourcemap src/index.ts --outfile=app\n# fromBuilder: build\n# entrypoint: /app/apps/server/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,32 @@ | ||
ignore: | ||
- node_modules | ||
- /apps/docs | ||
- /apps/screenshot-service | ||
- /apps/web | ||
- /packages/api | ||
- /packages/integrations/vercel | ||
builders: | ||
install: | ||
fromImage: oven/bun | ||
workdir: /app/apps/server | ||
# Copy project | ||
copy: . /app/ | ||
# Install dependencies | ||
root: | ||
run: | ||
- bun install --ignore-scripts --frozen-lockfile | ||
cache: | ||
- /root/.bun/install/cache | ||
build: | ||
fromBuilder: install | ||
# Compile the TypeScript application | ||
root: | ||
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 |