Skip to content

Commit

Permalink
feat: Added dockerfile.
Browse files Browse the repository at this point in the history
Does not work properly at the moment, because of:
* issues with cypress and bun: cypress-io/cypress#28962
* issues with nx hang: nrwl/nx#27494
  • Loading branch information
OysteinAmundsen committed Feb 4, 2025
1 parent 69381dc commit 04781a8
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 11 deletions.
19 changes: 19 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
node_modules
Dockerfile*
docker-compose*
.dockerignore
.git
.gitignore
README.md
LICENSE
.vscode
Makefile
helm-charts
.env
.editorconfig
.idea
.angular
.nx
tmp
dist
coverage*
32 changes: 32 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# use the official Bun image
# see all versions at https://hub.docker.com/r/oven/bun/tags
FROM oven/bun:1 AS base
WORKDIR /usr/src/app
RUN apt-get update && \
apt-get install -y \
git \
unzip

# install dependencies into temp directory
# this will cache them and speed up future builds
FROM base AS builder
COPY package.json bun.lockb ./
RUN bun install --frozen-lockfile
COPY . .
# Currently hangs because of https://github.com/nrwl/nx/issues/27494
RUN export NX_DAEMON=false NX_ISOLATE_PLUGINS=false && \
bun run build

# copy compiled code into final image
FROM base AS release
# Don't know yet if having node_modules in the final image is needed.
# If it is, we probably should install a production version
# of our dependencies in the builder stage and copy them here.
# COPY --from=builder /usr/src/app/node_modules ./node_modules
COPY --from=builder /usr/src/app/dist .
COPY --from=builder /usr/src/app/package.json .

# run the app
USER bun
EXPOSE 4200/tcp
ENTRYPOINT [ "bun", "dist/apps/home/server/server.mjs" ]
18 changes: 9 additions & 9 deletions nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,15 @@
}
},
"plugins": [
{
"plugin": "@nx/cypress/plugin",
"options": {
"targetName": "e2e",
"openTargetName": "open-cypress",
"componentTestingTargetName": "component-test",
"ciTargetName": "e2e-ci"
}
},
// {
// "plugin": "@nx/cypress/plugin",
// "options": {
// "targetName": "e2e",
// "openTargetName": "open-cypress",
// "componentTestingTargetName": "component-test",
// "ciTargetName": "e2e-ci"
// }
// },
{
"plugin": "@nx/eslint/plugin",
"options": {
Expand Down
4 changes: 2 additions & 2 deletions tools/builder/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"name": "@home/builder",
"version": "0.0.1",
"dependencies": {
"@angular-devkit/architect": "0.1900.7",
"@angular-devkit/core": "19.0.7",
"@angular-devkit/architect": "0.1901.5",
"@angular-devkit/core": "19.1.5",
"esbuild": "^0.24.0",
"rxjs": "~7.8.1",
"tslib": "^2.3.0"
Expand Down

0 comments on commit 04781a8

Please sign in to comment.