diff --git a/api/.dockerignore b/api/.dockerignore new file mode 100644 index 0000000..a14702c --- /dev/null +++ b/api/.dockerignore @@ -0,0 +1,34 @@ +# dependencies (bun install) +node_modules + +# output +out +dist +*.tgz + +# code coverage +coverage +*.lcov + +# logs +logs +_.log +report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json + +# dotenv environment variable files +.env +.env.development.local +.env.test.local +.env.production.local +.env.local + +# caches +.eslintcache +.cache +*.tsbuildinfo + +# IntelliJ based IDEs +.idea + +# Finder (MacOS) folder config +.DS_Store diff --git a/api/.gitignore b/api/.gitignore new file mode 100644 index 0000000..a14702c --- /dev/null +++ b/api/.gitignore @@ -0,0 +1,34 @@ +# dependencies (bun install) +node_modules + +# output +out +dist +*.tgz + +# code coverage +coverage +*.lcov + +# logs +logs +_.log +report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json + +# dotenv environment variable files +.env +.env.development.local +.env.test.local +.env.production.local +.env.local + +# caches +.eslintcache +.cache +*.tsbuildinfo + +# IntelliJ based IDEs +.idea + +# Finder (MacOS) folder config +.DS_Store diff --git a/api/Dockerfile b/api/Dockerfile new file mode 100644 index 0000000..fd83d56 --- /dev/null +++ b/api/Dockerfile @@ -0,0 +1,13 @@ +# Build Stage +FROM oven/bun:1 AS build +WORKDIR /app +COPY . . +RUN bun install + +# Runtime Stage (Distroless) +FROM oven/bun:distroless +WORKDIR /app +COPY --from=build /app/node_modules /app/app.ts ./ + +EXPOSE 4000 +ENTRYPOINT ["bun", "run", "app.ts"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..b7a4d8b --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,23 @@ +services: + database: + image: postgres:18 + environment: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + POSTGRES_DB: postgres + api: + image: ghcr.io/akra/example-app/api:1.0 + build: + context: ./api + dockerfile: Dockerfile + environment: + DATABASE_URL: postgres://postgres:postgres@database:5432/postgres + frontend: + image: ghcr.io/akra/example-app/frontend:1.0 + build: + context: ./frontend + dockerfile: Dockerfile + ports: + - "4000:4000" + environment: + API_URL: http://api:4000 diff --git a/frontend/.dockerignore b/frontend/.dockerignore new file mode 100644 index 0000000..a14702c --- /dev/null +++ b/frontend/.dockerignore @@ -0,0 +1,34 @@ +# dependencies (bun install) +node_modules + +# output +out +dist +*.tgz + +# code coverage +coverage +*.lcov + +# logs +logs +_.log +report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json + +# dotenv environment variable files +.env +.env.development.local +.env.test.local +.env.production.local +.env.local + +# caches +.eslintcache +.cache +*.tsbuildinfo + +# IntelliJ based IDEs +.idea + +# Finder (MacOS) folder config +.DS_Store diff --git a/frontend/.gitignore b/frontend/.gitignore new file mode 100644 index 0000000..a14702c --- /dev/null +++ b/frontend/.gitignore @@ -0,0 +1,34 @@ +# dependencies (bun install) +node_modules + +# output +out +dist +*.tgz + +# code coverage +coverage +*.lcov + +# logs +logs +_.log +report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json + +# dotenv environment variable files +.env +.env.development.local +.env.test.local +.env.production.local +.env.local + +# caches +.eslintcache +.cache +*.tsbuildinfo + +# IntelliJ based IDEs +.idea + +# Finder (MacOS) folder config +.DS_Store diff --git a/frontend/Dockerfile b/frontend/Dockerfile new file mode 100644 index 0000000..fd83d56 --- /dev/null +++ b/frontend/Dockerfile @@ -0,0 +1,13 @@ +# Build Stage +FROM oven/bun:1 AS build +WORKDIR /app +COPY . . +RUN bun install + +# Runtime Stage (Distroless) +FROM oven/bun:distroless +WORKDIR /app +COPY --from=build /app/node_modules /app/app.ts ./ + +EXPOSE 4000 +ENTRYPOINT ["bun", "run", "app.ts"]