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

Update Dockerfile to reflect module splitting #747

Merged
merged 9 commits into from
Apr 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/deploy-docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
uses: actions/checkout@v4
with:
lfs: false
submodules: false
submodules: true

- name: Do pull to ensure up-to-date
run: git pull
Expand Down
2 changes: 1 addition & 1 deletion modules/benchmark
2 changes: 1 addition & 1 deletion modules/cli
Submodule cli updated from b1df5a to 6a4c41
2 changes: 1 addition & 1 deletion modules/statistics
1 change: 0 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 15 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,43 +74,43 @@
{
"zones": [
{
"target": "benchmark",
"target": "modules/benchmark",
"from": [
"cli",
"modules/cli",
"src",
"statistics"
"modules/statistics"
]
},
{
"target": "cli",
"target": "modules/cli",
"from": [
"benchmark",
"modules/benchmark",
"src",
"statistics"
"modules/statistics"
]
},
{
"target": "statistics",
"target": "modules/statistics",
"from": [
"benchmark",
"cli",
"modules/benchmark",
"modules/cli",
"src"
]
},
{
"target": "src",
"from": [
"benchmark",
"cli",
"statistics"
"modules/benchmark",
"modules/cli",
"modules/statistics"
]
},
{
"target": "test",
"from": [
"benchmark",
"cli",
"statistics"
"modules/benchmark",
"modules/cli",
"modules/statistics"
]
}
]
Expand Down
34 changes: 28 additions & 6 deletions scripts/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,18 @@ FROM node:21.4-alpine3.19 AS builder

WORKDIR /app

# copy all modules into the workdir
COPY ./src /app/src/
COPY ./package.json ./package-lock.json ./tsconfig.json /app/
COPY ./modules/benchmark /app/modules/benchmark
COPY ./modules/cli /app/modules/cli
COPY ./modules/statistics /app/modules/statistics

RUN npm install
RUN npm run build
# install and build all modules
RUN npm install && npm run build
RUN cd modules/benchmark && npm install && npm run build
RUN cd modules/cli && npm install && npm run build
RUN cd modules/statistics && npm install && npm run build


FROM node:21.4-alpine3.19 AS flowR
Expand All @@ -19,11 +26,26 @@ WORKDIR /app

RUN apk add --no-cache R

# we keep the package.json for module resolution
COPY ./package.json ./scripts/demo.R LICENSE /app/
COPY ./scripts/demo.R LICENSE /app/

# copy all package.jsons so we can install them (see below)
COPY ./package.json /app/
COPY ./modules/benchmark/package.json /app/modules/benchmark/
COPY ./modules/cli/package.json /app/modules/cli/
COPY ./modules/statistics/package.json /app/modules/statistics/

# install all modules so that we have dependencies in here too
# (we don't copy them from the builder because builder modules include dev deps too)
RUN npm install --omit=dev
RUN cd modules/benchmark && npm install --omit=dev
RUN cd modules/cli && npm install --omit=dev
RUN cd modules/statistics && npm install --omit=dev

COPY --from=builder /app/dist/src /app/dist
RUN rm -rf /app/dist/tsconfig.tsbuildinfo
COPY --from=builder /app/modules/benchmark/dist /app/modules/benchmark/dist
COPY --from=builder /app/modules/cli/dist/src /app/modules/cli/dist
COPY --from=builder /app/modules/statistics/dist /app/modules/statistics/dist

RUN rm -rf /app/**/tsconfig.tsbuildinfo

ENTRYPOINT ["node", "/app/dist/flowr.js"]
ENTRYPOINT ["node", "/app/modules/cli/dist/flowr.js"]
4 changes: 1 addition & 3 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
"exclude": [
"node_modules/**/*",
"dist/**/*",
"cli",
"benchmark",
"statistics"
"modules/**/*"
]
}