-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add caddy config * update github build * fx caddy runner
- Loading branch information
Showing
8 changed files
with
113 additions
and
100 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
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,5 @@ | ||
:80 { | ||
reverse_proxy /trpc/* localhost:2021 | ||
reverse_proxy /admin/* localhost:9000 | ||
reverse_proxy /* localhost:3000 | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
FROM node:20-alpine AS custom-node | ||
|
||
RUN echo "http://dl-cdn.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories | ||
|
||
RUN apk add -f --update --no-cache --virtual .gyp nano bash libc6-compat python3 make g++ caddy \ | ||
&& yarn global add turbo \ | ||
&& apk del .gyp | ||
|
||
|
||
FROM custom-node AS pruned | ||
WORKDIR /app | ||
|
||
COPY . . | ||
|
||
RUN turbo prune --scope=admin --scope=frontend --scope=backend --docker | ||
|
||
FROM custom-node AS installer | ||
WORKDIR /app | ||
|
||
COPY --from=pruned /app/out/json/ . | ||
COPY --from=pruned /app/out/yarn.lock /app/yarn.lock | ||
|
||
RUN \ | ||
--mount=type=cache,target=/usr/local/share/.cache/yarn/v6,sharing=private \ | ||
yarn | ||
|
||
FROM custom-node as builder | ||
WORKDIR /app | ||
ARG API_URL | ||
ARG COMMIT | ||
|
||
ENV COMMIT=${COMMIT} | ||
ENV API_URL=${API_URL} | ||
|
||
COPY --from=installer --link /app . | ||
|
||
COPY --from=pruned /app/out/full/ . | ||
COPY turbo.json turbo.json | ||
COPY tsconfig.json tsconfig.json | ||
|
||
RUN turbo run build --no-cache | ||
|
||
RUN \ | ||
--mount=type=cache,target=/usr/local/share/.cache/yarn/v6,sharing=private \ | ||
yarn --frozen-lockfile | ||
|
||
############################################# | ||
FROM custom-node AS runner | ||
WORKDIR /app | ||
|
||
COPY Caddyfile /etc/caddy/Caddyfile | ||
COPY pm2.js /app/pm2.js | ||
|
||
COPY --from=builder /app . | ||
|
||
CMD ["sh", "-c", "caddy run --config /etc/caddy/Caddyfile & pm2-runtime start pm2.js"] |
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
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,19 @@ | ||
module.exports = { | ||
apps: [ | ||
{ | ||
name: "frontend", | ||
script: "yarn workspace frontend start", | ||
watch: false, | ||
}, | ||
{ | ||
name: "admin", | ||
script: "yarn workspace admin start", | ||
watch: false, | ||
}, | ||
{ | ||
name: "backend", | ||
script: "yarn workspace backend start", | ||
watch: false, | ||
}, | ||
], | ||
}; |
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 |
---|---|---|
@@ -1,60 +1,36 @@ | ||
version: "3.8" | ||
name: celluloid-test-stack | ||
|
||
x-defaults: &defaults | ||
init: true | ||
tty: true | ||
|
||
volumes: | ||
app_db_data: | ||
|
||
services: | ||
postgres: | ||
<<: *defaults | ||
image: postgres:13 | ||
ports: | ||
- "5432:5432" | ||
volumes: | ||
- app_db_data:/var/lib/postgresql/data | ||
- ./scripts/pg-init-scripts.sh:/docker-entrypoint-initdb.d/init.sh | ||
environment: | ||
POSTGRES_PASSWORD: postgres_password | ||
POSTGRES_MULTIPLE_DATABASES: celluloid, keycloak | ||
healthcheck: | ||
test: "PGPASSWORD=${POSTGRES_PASSWORD} pg_isready -h 127.0.0.1 -U ${POSTGRES_USER} -d celluloid" | ||
|
||
frontend: | ||
<<: *defaults | ||
depends_on: | ||
- backend | ||
ports: | ||
- "3000:3000" | ||
command: yarn workspace frontend start | ||
environment: | ||
PORT: 3000 | ||
build: | ||
args: | ||
NODE_ENV: production | ||
APP: frontend | ||
START_COMMAND: start | ||
API_URL: http://127.0.0.1:2021 | ||
context: . | ||
POSTGRES_USER: postgres | ||
POSTGRES_PASSWORD: root | ||
POSTGRES_DB: celluloid | ||
|
||
backend: | ||
<<: *defaults | ||
celluloid: | ||
depends_on: | ||
- postgres | ||
ports: | ||
- "2021:2021" | ||
command: ["sh", "-c", "yarn prisma migrate deploy yarn backend start"] | ||
- "8080:80" | ||
environment: | ||
PORT: 2021 | ||
DATABASE_URL: postgres://postgres:root@localhost:5432/celluloid | ||
COOKIE_SECRET: changethistosecretcookie | ||
COOKIE_DOMAIN: 127.0.0.1 | ||
COOKIE_SECURE: false | ||
STORAGE_URL: http://localhost:9000 | ||
STORAGE_BUCKET: celluloid | ||
STORAGE_ACCESS_KEY: root | ||
STORAGE_SECRET_KEY: StrongPass2022 | ||
# image: celluloid-full:latest | ||
build: | ||
args: | ||
APP: backend | ||
START_COMMAND: start | ||
context: . | ||
dockerfile: ./Dockerfile.full |