-
-
Notifications
You must be signed in to change notification settings - Fork 274
Expand file tree
/
Copy pathcompose.yml
More file actions
98 lines (92 loc) · 2.35 KB
/
Copy pathcompose.yml
File metadata and controls
98 lines (92 loc) · 2.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#
# Local Docker workflows
#
# The services are profile-based so you can choose the workflow you need.
#
# Build the site and export the generated `dist/` to the host:
# docker compose --profile build up --build
#
# Preview the production build at http://localhost:4321:
# docker compose --profile preview up --build
#
# Start the Astro development server with source files mounted:
# docker compose --profile dev up --build
#
# Create a new article:
# docker compose --profile new run --rm new
#
# `--build` forces Docker to rebuild the image when the Dockerfile or build
# context changes. It is useful after changing dependencies or Docker config.
#
# The `preview` workflow runs the `build` service first and starts the
# Astro preview server only after the build completes successfully.
#
# The `dev` workflow mounts the repository into the container, so source
# changes are reflected immediately without rebuilding the image each time.
#
# The `new` workflow mounts `src/` and runs `astro-pure new` without
# leaving a long-running container behind.
#
x-image: &default-image astro-pure:local
services:
build:
profiles: [build, preview]
build:
context: .
target: build
image: *default-image
pull_policy: never
working_dir: /web
volumes:
- dist:/web/dist
- ./dist:/export
command: >
sh -c "bun run build &&
find /export -mindepth 1 -print -delete &&
cp -rv /web/dist/. /export/"
restart: "no"
preview:
profiles: [preview]
build:
context: .
target: build
image: *default-image
pull_policy: never
working_dir: /web
depends_on:
build:
condition: service_completed_successfully
ports:
- "4321:4321"
volumes:
- dist:/web/dist
command: bun run preview --host 0.0.0.0
dev:
profiles: [dev]
build:
context: .
target: build
image: *default-image
pull_policy: never
working_dir: /web
ports:
- "4321:4321"
volumes:
- .:/web
- node_modules:/web/node_modules
command: bun run dev --host 0.0.0.0
new:
profiles: [new]
build:
context: .
target: build
image: *default-image
pull_policy: never
working_dir: /web
volumes:
- ./src/content:/web/src/content
command: bun run pure new
restart: "no"
volumes:
dist:
node_modules: