Skip to content

Commit 08ff2af

Browse files
committed
feat(docker): relocate Dockerfile, add entrypoint
1 parent 6aeacd7 commit 08ff2af

File tree

4 files changed

+20
-3
lines changed

4 files changed

+20
-3
lines changed

.github/workflows/docker.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ on:
44
pull_request:
55
branches:
66
- main
7+
paths-ignore:
8+
- '**/*.md'
79
push:
810
branches:
911
- main
@@ -95,6 +97,7 @@ jobs:
9597
cache-from: type=gha
9698
cache-to: type=gha,mode=max
9799
context: ./appchain-agent
100+
file: ./appchain-agent/docker/Dockerfile
98101
tags: ${{ env.IMAGE_TEST }}:test
99102
load: true
100103

@@ -108,6 +111,7 @@ jobs:
108111
context-appchain=./appchain
109112
context-protokit=./protokit
110113
context: ./appchain-agent
114+
file: ./appchain-agent/docker/Dockerfile
111115
tags: ${{ steps.meta.outputs.tags }}
112116
labels: ${{ steps.meta.outputs.labels }}
113117
platforms: linux/amd64

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ image:
55
docker build \
66
--build-context context-appchain=../appchain \
77
--build-context context-protokit=../protokit \
8-
--file Dockerfile \
8+
--file docker/Dockerfile \
99
--tag $(docker_image) \
1010
.

Dockerfile renamed to docker/Dockerfile

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ WORKDIR /app/appchain-agent
1010
# Stage 1: Build
1111
FROM base AS builder
1212

13-
COPY package.json pnpm-lock.yaml ./
14-
1513
COPY --from=context-protokit / /app/protokit
1614
RUN --mount=type=cache,id=npm,target=/root/.npm \
1715
cd /app/protokit \
@@ -25,6 +23,7 @@ RUN --mount=type=cache,id=pnpm,target=${PNPM_HOME}/store \
2523
&& pnpm install --frozen-lockfile \
2624
&& pnpm build
2725

26+
COPY package.json pnpm-lock.yaml /app/appchain-agent/
2827
RUN --mount=type=cache,id=pnpm,target=${PNPM_HOME}/store \
2928
cd /app/appchain-agent \
3029
&& pnpm install --frozen-lockfile
@@ -36,6 +35,8 @@ RUN pnpm run build
3635
# Stage 2: Production image
3736
FROM base AS runner
3837

38+
ENV NODE_ENV=production
39+
3940
# install deps used by scripts
4041
RUN apk add --no-cache \
4142
bash \
@@ -50,4 +51,8 @@ RUN --mount=type=cache,id=pnpm,target=${PNPM_HOME}/store pnpm install --prod --f
5051

5152
COPY bin ./bin
5253

54+
COPY --chmod=0555 ./docker/entry.sh ./entry.sh
55+
5356
USER node
57+
58+
ENTRYPOINT ["./entry.sh"]

docker/entry.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/sh
2+
3+
# map env var name to the one used internally
4+
test ! -z "${URL_APPCHAIN_SEQUENCER}" \
5+
&& echo "URL_APPCHAIN_SEQUENCER=${URL_APPCHAIN_SEQUENCER}" \
6+
&& export NEXT_PUBLIC_PROTOKIT_GRAPHQL_URL="${URL_APPCHAIN_SEQUENCER}"
7+
8+
exec "$@"

0 commit comments

Comments
 (0)