Skip to content

Commit 843ddeb

Browse files
committed
add Dockerfile to build the playground
1 parent d823a90 commit 843ddeb

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

apps/playground/Dockerfile

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#The following Dockerfile uses a two stage build which first builds the playground and then copies it into the another caddy image to serve it
2+
3+
#use the apline contianer to build odc
4+
FROM alpine:latest AS builder
5+
6+
#install nodejs and required dependencies
7+
#RUN apk add --no-cache curl git build-base python3 nodejs-current npm bash openssl
8+
RUN apk add --no-cache nodejs-current npm bash openssl
9+
RUN npm install -g pnpm
10+
11+
#set the working dir and copy the current odc instance into the new container
12+
WORKDIR /src
13+
COPY . /src
14+
15+
#install dependencies, generate the environment, and build the playground
16+
RUN pnpm install
17+
RUN ./scripts/generate-env.sh
18+
RUN pnpm build --filter=@opendatacapture/playground
19+
20+
#use the caddy image to serve the playground
21+
FROM caddy:2.7-alpine
22+
23+
#overwrite the default caddy files with odc's
24+
RUN rm -rf /usr/share/caddy/*
25+
COPY --from=builder /src/apps/playground/dist /usr/share/caddy
26+
27+
#make caddy listen on port 3000 and serve odc
28+
RUN echo -e ":3000 {\n root * /usr/share/caddy\n file_server\n}\n" > /etc/caddy/Caddyfile
29+
EXPOSE 3000
30+
31+
#serve odc
32+
CMD ["caddy", "run", "--config", "/etc/caddy/Caddyfile"]

0 commit comments

Comments
 (0)