Skip to content

Commit

Permalink
fix:環境を修正
Browse files Browse the repository at this point in the history
  • Loading branch information
ayahiro1729 committed Aug 6, 2024
1 parent 397e7a2 commit 9b6352b
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 11 deletions.
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules
npm-debug.log
build
.dockerignore
Dockerfile
8 changes: 6 additions & 2 deletions compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,21 @@ services:
- "3000:3000"
volumes:
- ./frontend:/app
- /app/node_modules
networks:
- app-network
environment:
- CHOKIDAR_USEPOLLING=true
- WATCHPACK_POLLING=true

backend:
build:
context: .
dockerfile: ./docker/backend/Dockerfile
ports:
- "8080:8080"
# volumes:
# - ./backend:/app
volumes:
- ./backend:/onpu
networks:
- app-network

Expand Down
8 changes: 4 additions & 4 deletions docker/backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# ベースイメージを指定
FROM golang:1.22-alpine

# CompileDaemonをインストール
RUN go install github.com/githubnemo/CompileDaemon@latest

# 作業ディレクトリを設定
WORKDIR /app

Expand All @@ -14,11 +17,8 @@ RUN go mod tidy
# アプリケーションのソースコードをコピー
COPY ./backend .

# アプリケーションをビルド
RUN go build -o /app/main .

# ポートを指定
EXPOSE 8080

# アプリケーションを起動
CMD ["/app/main"]
CMD ["CompileDaemon", "--build=go build -o /app/main /app/main.go", "--command=/app/main"]
7 changes: 2 additions & 5 deletions docker/frontend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
FROM node:22-alpine

# 作業ディレクトリを設定
WORKDIR /onpu
WORKDIR /app

# package.jsonとpackage-lock.jsonをコピー
COPY ./frontend/package*.json ./
Expand All @@ -14,11 +14,8 @@ RUN npm install
# アプリケーションのソースコードをコピー
COPY ./frontend .

# アプリケーションをビルド
RUN npm run build

# ポートを指定
EXPOSE 3000

# アプリケーションを起動
CMD ["npm", "start"]
CMD ["npm", "run", "dev"]
3 changes: 3 additions & 0 deletions frontend/app/root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import {
} from "@remix-run/react";
import "./tailwind.css";

import { LiveReload } from "@remix-run/react";

export function Layout({ children }: { children: React.ReactNode }) {
return (
<html lang="en">
Expand All @@ -17,6 +19,7 @@ export function Layout({ children }: { children: React.ReactNode }) {
<Links />
</head>
<body>
<LiveReload />
{children}
<ScrollRestoration />
<Scripts />
Expand Down
7 changes: 7 additions & 0 deletions frontend/remix.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
watchPaths: ["app/**/*"],
ignoredRouteFiles: ["**/.*"],
serverBuildPath: "build/index.js",
assetsBuildDirectory: "public/build",
publicPath: "/build/",
};
10 changes: 10 additions & 0 deletions frontend/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,14 @@ export default defineConfig({
}),
tsconfigPaths(),
],
server: {
host: "0.0.0.0",
port: 3000,
hmr: {
clientPort: 3000,
},
watch: {
usePolling: true,
},
},
});

0 comments on commit 9b6352b

Please sign in to comment.