Working Docker build 🎉
This commit is contained in:
parent
d84018c787
commit
338224ef6b
@ -6,6 +6,7 @@ COPY . .
|
|||||||
|
|
||||||
RUN pnpm install
|
RUN pnpm install
|
||||||
ENV PAYLOAD_CONFIG_PATH=src/payload.config.ts
|
ENV PAYLOAD_CONFIG_PATH=src/payload.config.ts
|
||||||
|
ENV PAYLOAD_PUBLIC_SERVER_URL=http://localhost:3000
|
||||||
RUN pnpm build
|
RUN pnpm build
|
||||||
|
|
||||||
CMD ["pnpm", "serve"]
|
CMD ["pnpm", "serve"]
|
||||||
|
@ -9,7 +9,7 @@ app.get("/", (_, res) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const PORT = Number(process.env.PAYLOAD_PORT) ?? 3000;
|
const PORT = Number(process.env.PAYLOAD_PORT) ?? 3000;
|
||||||
const HOST = process.env.PAYLOAD_ADDRESS ?? 'localhost';
|
const HOST = process.env.PAYLOAD_HOST ?? 'localhost';
|
||||||
|
|
||||||
const start = async () => {
|
const start = async () => {
|
||||||
// Initialize Payload
|
// Initialize Payload
|
||||||
|
@ -9,16 +9,19 @@ export default defineConfig({
|
|||||||
integrations: [mdx(), tailwind(), svelte()],
|
integrations: [mdx(), tailwind(), svelte()],
|
||||||
server: {
|
server: {
|
||||||
port: parseInt(process.env.ASTRO_PORT ?? "3000"),
|
port: parseInt(process.env.ASTRO_PORT ?? "3000"),
|
||||||
|
// FIXME 3wc: seems to be ignored?
|
||||||
|
hostname: process.env.ASTRO_HOST ?? "0.0.0.0",
|
||||||
},
|
},
|
||||||
output: "server",
|
output: "server",
|
||||||
adapter: node({
|
adapter: node({
|
||||||
mode: "standalone",
|
mode: "standalone",
|
||||||
}),
|
}),
|
||||||
vite: {
|
vite: {
|
||||||
|
// FIXME 3wc: shouldn't need to hardcode this
|
||||||
define: {
|
define: {
|
||||||
"import.meta.env.PAYLOAD_PUBLIC_SERVER_URL": JSON.stringify(
|
"import.meta.env.PAYLOAD_PUBLIC_SERVER_URL": JSON.stringify(
|
||||||
process.env.PAYLOAD_PUBLIC_SERVER_URL,
|
"http://api:3001"
|
||||||
),
|
)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -2,7 +2,9 @@ import type { Page } from "@turbopress/api/types";
|
|||||||
import { getPayloadCollection } from "./api.service";
|
import { getPayloadCollection } from "./api.service";
|
||||||
|
|
||||||
export async function getPageCollection(query: any = null) {
|
export async function getPageCollection(query: any = null) {
|
||||||
const url = `${import.meta.env.PAYLOAD_PUBLIC_SERVER_URL}/api/pages`;
|
// FIXME 3wc: shouldn't need to hardcode this?!
|
||||||
|
//const url = `${import.meta.env.PAYLOAD_PUBLIC_SERVER_URL}/api/pages`;
|
||||||
|
const url = `http://api:3001/api/pages`;
|
||||||
return getPayloadCollection<Page>(url, query);
|
return getPayloadCollection<Page>(url, query);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
25
docker-compose.yml
Normal file
25
docker-compose.yml
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
---
|
||||||
|
version: "3"
|
||||||
|
|
||||||
|
services:
|
||||||
|
api:
|
||||||
|
image: justice-equity-technology:3a0b940
|
||||||
|
ports:
|
||||||
|
- 3001:3001
|
||||||
|
command: pnpm serve:api
|
||||||
|
env_file: .env
|
||||||
|
web:
|
||||||
|
image: justice-equity-technology:3a0b940
|
||||||
|
ports:
|
||||||
|
- 3000:3000
|
||||||
|
command: pnpm serve:web
|
||||||
|
env_file: .env
|
||||||
|
db:
|
||||||
|
image: mongo:latest
|
||||||
|
ports:
|
||||||
|
- 27017:27017
|
||||||
|
volumes:
|
||||||
|
- mongo:/data
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
mongo:
|
Loading…
Reference in New Issue
Block a user