Skip to content

Commit

Permalink
Update Dockerfile to reflect module splitting (#747)
Browse files Browse the repository at this point in the history
* ci: reflect module splitting in dockerfile (untested)

* refactor: bad copy-paste

* dep: updated submodules

* ci: ensure we check out submodules for docker deploy

* feat-fix: fixed outdated paths after refactor

* feat-fix: fixed up dockerfile

* refactor: dockerfile cleanup

* refactor: we don't need to copy to dist
  • Loading branch information
Ellpeck authored Apr 2, 2024
1 parent 5d2c1fa commit cc43e18
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 29 deletions.
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/**/*"
]
}

0 comments on commit cc43e18

Please sign in to comment.