Skip to content

Commit

Permalink
fix docker build (#249)
Browse files Browse the repository at this point in the history
* fix docker build

* keep only full container

* update caddy config

* fix pm2 config

* fix admin port
  • Loading branch information
younes200 authored Dec 4, 2023
1 parent 315dbbb commit a607946
Show file tree
Hide file tree
Showing 7 changed files with 846 additions and 98 deletions.
44 changes: 2 additions & 42 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,53 +29,13 @@ jobs:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build Backend
uses: docker/build-push-action@v3
with:
context: .
push: true
tags: ghcr.io/${{ github.repository }}/backend:${{ github.event.inputs.tag }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
COMMIT=${{ steps.vars.outputs.sha_short }}
APP=backend
START_COMMAND=start
- name: Build Admin
uses: docker/build-push-action@v3
with:
context: .
push: true
tags: ghcr.io/${{ github.repository }}/admin:${{ github.event.inputs.tag }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
COMMIT=${{ steps.vars.outputs.sha_short }}
APP=admin
START_COMMAND=start
- name: Build Frontend
uses: docker/build-push-action@v3
with:
context: .
push: true
tags: ghcr.io/${{ github.repository }}/frontend:${{ github.event.inputs.tag }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
COMMIT=${{ steps.vars.outputs.sha_short }}
APP=frontend
START_COMMAND=start
API_URL=/trpc
- name: Build full
- name: Build
uses: docker/build-push-action@v3
with:
file: Dockerfile.full
context: .
push: true
tags: ghcr.io/${{ github.repository }}/full:${{ github.event.inputs.tag }}
tags: ghcr.io/${{ github.repository }}/compact:${{ github.event.inputs.tag }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
Expand Down
Binary file modified .yarn/install-state.gz
Binary file not shown.
9 changes: 6 additions & 3 deletions Dockerfile.full
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,15 @@ RUN \
yarn --frozen-lockfile

#############################################
FROM custom-node AS runner
FROM node:20-alpine AS runner
WORKDIR /app

RUN echo "http://dl-cdn.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories
RUN apk add -f --update caddy bash

COPY Caddyfile /etc/caddy/Caddyfile
COPY pm2.js /app/pm2.js
COPY ecosystem.config.js /app/ecosystem.config.js

COPY --from=builder /app .

CMD ["sh", "-c", "caddy run --config /etc/caddy/Caddyfile & pm2-runtime start pm2.js"]
CMD ["sh", "-c", "caddy run --config /etc/caddy/Caddyfile & yarn pm2"]
25 changes: 25 additions & 0 deletions ecosystem.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
module.exports = {
apps: [
{
name: "frontend",
script: "yarn",
args: "frontend start",
interpreter: "bash",
watch: false,
},
{
name: "admin",
script: "yarn",
args: "admin start",
interpreter: "bash",
watch: false,
},
{
name: "backend",
script: "yarn",
args: "backend start",
interpreter: "bash",
watch: false,
},
],
};
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"prepare": "husky install",
"prettier:all": "prettier --ignore-path .eslintignore \"**/*.{js,jsx,ts,tsx,md}\"",
"test": "npx playwright test",
"pm2": "pm2-runtime start ecosystem.config.js",
"--shortcuts to run commands in workspaces--": "",
"frontend": "dotenv -- yarn workspace frontend",
"admin": "dotenv -- yarn workspace admin",
Expand Down Expand Up @@ -89,6 +90,7 @@
"abort-controller": "^3.0.0",
"dotenv": "^16.3.1",
"dotenv-cli": "^7.3.0",
"node-fetch": "2"
"node-fetch": "2",
"pm2": "^5.3.0"
}
}
19 changes: 0 additions & 19 deletions pm2.js

This file was deleted.

Loading

0 comments on commit a607946

Please sign in to comment.