Skip to content

Commit d0af8b0

Browse files
committed
feat: add development container via compose
1 parent 6064e79 commit d0af8b0

File tree

13 files changed

+80
-27
lines changed

13 files changed

+80
-27
lines changed

.dockerignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
!.env.*
22
.env.keys
3+
!frontend/dist
4+
node_modules

Makefile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
dev:
2+
sh scripts/package/dev.sh
3+
sh scripts/package/tail.sh
4+
5+
tail:
6+
sh scripts/package/tail.sh
7+
18
sign:
29
sh scripts/git/sign.sh
310

docker/Dockerfile.frontend

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,15 @@ RUN mv /root/.local/share/pnpm/pnpm /usr/bin/
55

66
WORKDIR /usr/src/app
77

8-
COPY .env.production ./
9-
COPY frontend/package.json ./
10-
COPY frontend/pnpm-lock.yaml ./
11-
COPY frontend/public ./public
12-
COPY frontend/dist ./dist
8+
COPY . .
139

14-
RUN pnpm install --prod
10+
RUN pnpm install --prod --force
1511

1612
FROM node:22.12-alpine3.20 AS runner
1713

18-
RUN apk --no-cache add curl
19-
RUN curl -sfS https://dotenvx.sh/install.sh | sh
20-
2114
WORKDIR /usr/src/app
2215

2316
COPY --from=deps /usr/bin/pnpm /usr/bin/
24-
COPY --from=deps /usr/src/app/.env.production ./
2517
COPY --from=deps /usr/src/app/node_modules ./node_modules
2618
COPY --from=deps /usr/src/app/public ./public
2719
COPY --from=deps /usr/src/app/dist ./dist

docker/docker-compose.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: instructor-local-dev
2+
version: "3.8"
3+
services:
4+
frontend:
5+
build:
6+
context: ../frontend
7+
dockerfile: ../docker/Dockerfile.frontend
8+
ports:
9+
- "3001:3000"
10+
depends_on:
11+
- backend
12+
networks:
13+
- app-network
14+
15+
backend:
16+
build:
17+
context: ../http
18+
dockerfile: ../docker/Dockerfile.backend
19+
ports:
20+
- "3333:3333"
21+
networks:
22+
- app-network
23+
24+
networks:
25+
app-network:
26+
driver: bridge

frontend/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!doctype html>
1+
<!DOCTYPE html>
22
<html lang="en" class="light">
33
<head>
44
<meta charset="UTF-8" />

frontend/src/app/error.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@ function ErrorDisplay({
66
error?: Error;
77
resetErrorBoundary?: () => void;
88
}) {
9+
const displayError =
10+
error ?? Object(error).response?.data ?? "Unknown error!";
911
return (
1012
<div role="alert">
1113
<p>Something went wrong:</p>
12-
<pre style={{ color: "red" }}>{error.message}</pre>
14+
<pre style={{ color: "red" }}>{JSON.stringify(displayError)}</pre>
1315
</div>
1416
);
1517
}

frontend/src/app/product/component.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { use } from "react";
2-
import { client } from "../../../lib/http";
2+
import { client } from "@/lib/http";
33

44
const promise = client.get("/");
55

frontend/src/app/product/index.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
"use client";
2-
31
import { Suspense } from "react";
42
import Component from "./component";
53

frontend/src/global.css

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
@import "tailwindcss";
22
@import "./fonts.css";
3-
@import "tailwind/preflight";
43

54
@tailwind utilities;
65

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,4 @@ import axios from "axios";
33
export const client = axios.create({
44
method: "GET",
55
baseURL: "http://localhost:3333",
6-
headers: { "Access-Control-Allow-Origin": "*" },
76
});

0 commit comments

Comments
 (0)