Skip to content

Commit

Permalink
refacto: bun in the oven
Browse files Browse the repository at this point in the history
  • Loading branch information
douglasduteil committed Dec 13, 2023
1 parent c966ca8 commit 92df083
Show file tree
Hide file tree
Showing 12 changed files with 258 additions and 206 deletions.
1 change: 1 addition & 0 deletions .buildpacks
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
https://github.com/confact/bun-buildpack
10 changes: 1 addition & 9 deletions .env
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
HOST: http://localhost:3000
PORT: 3000
SITE_TITLE: "Bonjour monde !"
STYLESHEET_URL: https://unpkg.com/bamboo.css
CALLBACK_URL: /login-callback
MCP_CLIENT_ID: client_id
MCP_CLIENT_SECRET: client_secret
MCP_PROVIDER: https://app-test.moncomptepro.beta.gouv.fr/
MCP_SCOPES: "openid email profile organization"
LOGIN_HINT: ""
MCP_ID_TOKEN_SIGNED_RESPONSE_ALG: RS256
MCP_USERINFO_SIGNED_RESPONSE_ALG: ""
MCP_PROVIDER: https://app-test.moncomptepro.beta.gouv.fr/
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ jobs:
cache: "npm"
node-version-file: package.json
- run: npm ci
- run: timout 1 npm start

e2e:
runs-on: ubuntu-latest
Expand Down
36 changes: 24 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,19 +1,31 @@
FROM node:16
#

FROM oven/bun:1 as base

# Create app directory
WORKDIR /usr/src/app

# Install app dependencies
# A wildcard is used to ensure both package.json AND package-lock.json are copied
# where available (npm@5+)
COPY package*.json ./
#

FROM base AS install

RUN mkdir -p /temp/prod
COPY package.json bun.lockb /temp/prod/
RUN cd /temp/prod && bun install --frozen-lockfile --production

#

RUN npm install
# If you are building your code for production
# RUN npm ci --omit=dev
FROM base AS prerelease

# Bundle app source
COPY . .

EXPOSE 3000
CMD [ "npm", "start" ]
#

FROM base AS release

COPY --from=install /temp/prod/node_modules node_modules
COPY --from=prerelease /usr/src/app/index.ts .
COPY --from=prerelease /usr/src/app/package.json .

USER bun
EXPOSE 3000/tcp
ENTRYPOINT [ "bun", "run", "index.ts" ]
Binary file added bun.lockb
Binary file not shown.
Binary file added e2e/bun.lockb
Binary file not shown.
4 changes: 4 additions & 0 deletions e2e/features/connexion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ import { Given, Then, When } from "@badeball/cypress-cucumber-preprocessor";

//

Cypress.Cookies.debug(true);

//

Given("je navigue sur la page", () => {
cy.visit("/");
});
Expand Down
14 changes: 7 additions & 7 deletions e2e/package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"private": true,
"type": "module",
"scripts": {
"test": "cypress run",
"start": "cd .. && npm start"
},
"devDependencies": {
"@badeball/cypress-cucumber-preprocessor": "^19.2.0",
"@bahmutov/cypress-esbuild-preprocessor": "^2.2.0",
"cypress": "^13.6.1",
"typescript": "^5.3.3"
}
},
"private": true,
"scripts": {
"test": "cypress run",
"start": "cd .. && npm start"
},
"type": "module"
}
168 changes: 0 additions & 168 deletions index.js

This file was deleted.

Loading

0 comments on commit 92df083

Please sign in to comment.