-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #121 from friday-ai/docker
Big project update
- Loading branch information
Showing
198 changed files
with
4,474 additions
and
3,718 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,34 @@ | ||
# Base image node ---------------------------------------- | ||
FROM node:18-alpine as base | ||
|
||
# System dependencies | ||
RUN apk add --no-cache sqlite make python3 gcc g++ \ | ||
&& npm install -g pnpm@8 turbo | ||
|
||
USER node | ||
WORKDIR /src | ||
|
||
RUN pnpm config set store-dir .pnpm-store && pnpm config set node-linker hoisted | ||
|
||
# Friday builder image ----------------------------------- | ||
FROM base as builder | ||
|
||
HEALTHCHECK --interval=1s --retries=3600 \ | ||
CMD test -f ./task_finished.txt || exit 1 | ||
|
||
# Start container | ||
CMD pnpm install && turbo build && touch task_finished.txt && sleep 4s | ||
|
||
# Friday server image ------------------------------------- | ||
FROM base as server | ||
|
||
# Start container | ||
EXPOSE 3001 | ||
CMD pnpm start:dev | ||
|
||
# Friday front image ------------------------------------- | ||
FROM base as front | ||
|
||
# Start container | ||
EXPOSE 3001 | ||
CMD pnpm start:dev |
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,62 @@ | ||
# base image node ---------------------------------------- | ||
FROM node:18-alpine as base | ||
|
||
# System dependencies | ||
RUN apk add --no-cache curl | ||
|
||
WORKDIR /src | ||
|
||
CMD npm run start:prod | ||
|
||
# builder ------------------------------------------------ | ||
FROM base as builder | ||
|
||
# System dependencies | ||
RUN apk add --no-cache sqlite make | ||
|
||
# Builder dependencies | ||
RUN npm install -g pnpm@8 turbo | ||
|
||
WORKDIR /usr/src | ||
|
||
COPY ../pnpm-lock.yaml ./ | ||
COPY ../*.npmrc ./ | ||
|
||
COPY ../ ./ | ||
|
||
RUN pnpm fetch \ | ||
&& pnpm install -r \ | ||
&& turbo build | ||
|
||
# Friday front ------------------------------------------- | ||
FROM base as front | ||
|
||
# Front dependencies | ||
RUN npm install -g http-server | ||
|
||
# Add friday core | ||
COPY --from=builder /usr/src/apps/front/dist ./dist | ||
|
||
COPY ../apps/front/package.json ./ | ||
|
||
ENV NODE_ENV production | ||
|
||
# Export listening port | ||
EXPOSE 1444 | ||
|
||
# Friday back ------------------------------------------ | ||
FROM base as server | ||
|
||
# Server dependencies | ||
RUN npm install mqtt sqlite3 ssh2 | ||
RUN npm install -g cross-env | ||
|
||
# Add friday core | ||
COPY --from=builder /usr/src/apps/server/dist ./dist | ||
|
||
COPY ../apps/server/package.json ./ | ||
|
||
ENV NODE_ENV production | ||
|
||
# Export listening port | ||
EXPOSE 1443 |
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,80 @@ | ||
version: "3.9" | ||
|
||
services: | ||
builder: | ||
container_name: builder-dev | ||
image: fridayai/friday-builder:dev | ||
build: | ||
context: ../ | ||
dockerfile: ./.docker/Dockerfile-development | ||
target: builder | ||
restart: on-failure | ||
volumes: | ||
- ../.pnpm-store:/src/.pnpm-store | ||
- ../apps:/src/apps | ||
- ../packages:/src/packages | ||
- ../package.json:/src/package.json | ||
- ../pnpm-lock.yaml:/src/pnpm-lock.yaml | ||
- ../pnpm-workspace.yaml:/src/pnpm-workspace.yaml | ||
- ../node_modules:/src/node_modules | ||
|
||
server: | ||
container_name: server-dev | ||
image: fridayai/friday-server:dev | ||
build: | ||
context: ../ | ||
dockerfile: ./.docker/Dockerfile-development | ||
target: server | ||
depends_on: | ||
builder: | ||
condition: service_healthy | ||
ports: | ||
- "3000:3000" | ||
environment: | ||
- NODE_ENV=development | ||
- MQTT_HOST=host.docker.internal | ||
volumes: | ||
- ../.pnpm-store:/src/.pnpm-store | ||
- ../apps/server:/src/apps/server | ||
- ../packages:/src/packages | ||
- ../package.json:/src/package.json | ||
- ../pnpm-lock.yaml:/src/pnpm-lock.yaml | ||
- ../pnpm-workspace.yaml:/src/pnpm-workspace.yaml | ||
- ../node_modules:/src/node_modules | ||
|
||
front: | ||
container_name: front-dev | ||
image: fridayai/friday-front:dev | ||
build: | ||
context: ../ | ||
dockerfile: ./.docker/Dockerfile-development | ||
target: front | ||
depends_on: | ||
builder: | ||
condition: service_healthy | ||
ports: | ||
- "3001:3001" | ||
environment: | ||
- NODE_ENV=development | ||
volumes: | ||
- ../.pnpm-store:/src/.pnpm-store | ||
- ../apps/front:/src/apps/front | ||
- ../packages:/src/packages | ||
- ../package.json:/src/package.json | ||
- ../pnpm-lock.yaml:/src/pnpm-lock.yaml | ||
- ../pnpm-workspace.yaml:/src/pnpm-workspace.yaml | ||
- ../node_modules:/src/node_modules | ||
|
||
broker: | ||
container_name: broker-dev | ||
image: eclipse-mosquitto:latest | ||
restart: always | ||
ports: | ||
- "1883:1883" | ||
- "9001:9001" | ||
volumes: | ||
- ../.docker/mosquitto/config/mosquitto.conf:/mosquitto/config/mosquitto.conf | ||
- ../.docker/mosquitto/data:/mosquitto/data | ||
environment: | ||
- TZ=Europe/Paris | ||
user: 1000:1000 |
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,51 @@ | ||
version: "3.9" | ||
|
||
services: | ||
server: | ||
container_name: friday-server | ||
image: fridayai/friday-server:latest | ||
build: | ||
context: ../ | ||
dockerfile: ./.docker/Dockerfile-production | ||
target: server | ||
ports: | ||
- "1443:1443" | ||
environment: | ||
- NODE_ENV=production | ||
- MQTT_HOST=host.docker.internal | ||
|
||
front: | ||
container_name: friday-front | ||
image: fridayai/friday-front:latest | ||
build: | ||
context: ../ | ||
dockerfile: ./.docker/Dockerfile-production | ||
target: front | ||
depends_on: | ||
- server | ||
ports: | ||
- "1444:1444" | ||
environment: | ||
- NODE_ENV=production | ||
|
||
broker: | ||
container_name: friday-broker | ||
image: eclipse-mosquitto:latest | ||
restart: always | ||
ports: | ||
- "1883:1883" | ||
- "9001:9001" | ||
volumes: | ||
- ../.docker/mosquitto/config/mosquitto.conf:/mosquitto/config/mosquitto.conf | ||
- ../.docker/mosquitto/data:/mosquitto/data | ||
environment: | ||
- TZ=Europe/Paris | ||
user: 1000:1000 | ||
|
||
watchtower: | ||
container_name: friday-watchtower | ||
image: containrrr/watchtower | ||
restart: always | ||
volumes: | ||
- /var/run/docker.sock:/var/run/docker.sock | ||
command: --cleanup |
File renamed without changes.
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 |
---|---|---|
|
@@ -20,3 +20,8 @@ node.d.ts | |
.git | ||
docker | ||
.github | ||
.pnpm-store | ||
node_modules | ||
lib | ||
dist | ||
.turbo |
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,10 @@ | ||
// This configuration only applies to the package manager root. | ||
/** @type {import("eslint").Linter.Config} */ | ||
module.exports = { | ||
ignorePatterns: ["apps/**", "packages/**"], | ||
extends: ["@friday-ai/tools/eslint/base.js"], | ||
parser: "@typescript-eslint/parser", | ||
parserOptions: { | ||
project: true, | ||
}, | ||
}; |
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
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
Oops, something went wrong.