Skip to content

Commit 9b752d3

Browse files
committed
Update Dockerfile to support character files from GCS
1 parent fefd520 commit 9b752d3

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

Dockerfile

+19-6
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ COPY package.json pnpm-lock.yaml pnpm-workspace.yaml .npmrc turbo.json ./
2121
COPY agent ./agent
2222
COPY packages ./packages
2323
COPY scripts ./scripts
24-
COPY characters ./characters
24+
# Don't copy characters folder as we'll get it from GCS
2525

2626
# Install dependencies and build the project
2727
RUN pnpm install \
@@ -31,10 +31,14 @@ RUN pnpm install \
3131
# Create a new stage for the final image
3232
FROM node:23.3.0-slim
3333

34-
# Install runtime dependencies if needed
34+
# Install runtime dependencies and Google Cloud SDK
3535
RUN npm install -g pnpm@9.4.0 && \
3636
apt-get update && \
37-
apt-get install -y git python3 && \
37+
apt-get install -y git python3 curl gnupg && \
38+
echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] http://packages.cloud.google.com/apt cloud-sdk main" | tee -a /etc/apt/sources.list.d/google-cloud-sdk.list && \
39+
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key --keyring /usr/share/keyrings/cloud.google.gpg add - && \
40+
apt-get update && \
41+
apt-get install -y google-cloud-sdk && \
3842
apt-get clean && \
3943
rm -rf /var/lib/apt/lists/*
4044

@@ -49,7 +53,16 @@ COPY --from=builder /app/node_modules ./node_modules
4953
COPY --from=builder /app/agent ./agent
5054
COPY --from=builder /app/packages ./packages
5155
COPY --from=builder /app/scripts ./scripts
52-
COPY --from=builder /app/characters ./characters
5356

54-
# Set the command to run the application
55-
CMD ["pnpm", "start", "--non-interactive"]
57+
# Create characters directory
58+
RUN mkdir -p characters
59+
60+
# Set default environment variables
61+
ENV PORT=8080
62+
ENV SERVER_PORT=8080
63+
64+
# Expose the port
65+
EXPOSE 8080
66+
67+
# Modified command to fetch character file from GCS before starting
68+
CMD sh -c "gsutil cp gs://$BUCKET_NAME/$CHARACTER_FILE characters/character.json && pnpm start --non-interactive --characters=characters/character.json"

0 commit comments

Comments
 (0)