-
Notifications
You must be signed in to change notification settings - Fork 1
feat(docker): update Temporal setup and add worker configuration #28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
f04cb9e
feat(docker): update Temporal setup and add worker configuration
anatolyshipitz 509d906
feat(error-handling): refactor error handling in main script and add …
anatolyshipitz 745a049
fix(eslint): update ESLint configuration and improve test structure
anatolyshipitz f4207fb
refactor(docker): simplify Dockerfile by removing netcat installation
anatolyshipitz 31dfaff
Update dependencies (#29)
anatolyshipitz c930aef
refactor(logging): enhance error handling and logging in main worker
anatolyshipitz 49898bd
refactor(tests): clean up error handling tests in index.test.ts
anatolyshipitz 9b04e97
fix(workflows): update dependency installation method in code quality…
anatolyshipitz c198eb2
feat(dependencies): add new Temporal dependencies and source-map-support
anatolyshipitz 39f1d79
feat(dependencies): update package-lock.json with new and modified de…
anatolyshipitz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,23 @@ | ||
FROM temporalio/auto-setup:1.20.5 | ||
FROM temporalio/auto-setup:1.27.2 | ||
|
||
# Build arguments are still needed for the temporal container setup | ||
# Keeping only those used in the HEALTHCHECK or other commands | ||
# Set build arguments and environment variables | ||
ARG HOST=temporal | ||
ARG POSTGRES_SEEDS=postgresql | ||
ARG POSTGRES_USER=temporal | ||
ARG POSTGRES_DB_TEMPORAL_VISIBILITY=temporal_visibility | ||
ARG DB_PORT=5432 | ||
ARG TEMPORAL_PORT=7233 | ||
|
||
RUN temporal-sql-tool --plugin postgres \ | ||
--endpoint "$POSTGRES_SEEDS" \ | ||
--user "$POSTGRES_USER" \ | ||
--port "$DB_PORT" \ | ||
--database "$POSTGRES_DB_TEMPORAL_VISIBILITY" \ | ||
setup-schema -v 0.0 && \ | ||
temporal-sql-tool --plugin postgres \ | ||
--endpoint "$POSTGRES_SEEDS" \ | ||
--user "$POSTGRES_USER" \ | ||
--port "$DB_PORT" \ | ||
--database "$POSTGRES_DB_TEMPORAL_VISIBILITY" \ | ||
update-schema -d /etc/temporal/schema/postgresql/v96/visibility/versioned | ||
ENV POSTGRES_SEEDS=$POSTGRES_SEEDS \ | ||
POSTGRES_USER=$POSTGRES_USER \ | ||
POSTGRES_DB_TEMPORAL_VISIBILITY=$POSTGRES_DB_TEMPORAL_VISIBILITY \ | ||
DB_PORT=$DB_PORT \ | ||
TEMPORAL_PORT=$TEMPORAL_PORT | ||
|
||
# Add custom healthcheck using exec form | ||
HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=3 \ | ||
CMD ["/bin/sh", "-c", "temporal operator cluster health --address ${HOST}:${TEMPORAL_PORT} | grep -q SERVING || exit 1"] | ||
HEALTHCHECK --interval=10s --timeout=5s --start-period=30s --retries=5 \ | ||
CMD sh -c "tctl --address temporal:7233 cluster health" | ||
|
||
# Explicitly set the user to the non-root 'temporal' user (already defined in the base image) | ||
USER temporal | ||
|
||
# Expose the gRPC port | ||
EXPOSE ${TEMPORAL_PORT} | ||
|
||
# The entrypoint script is already defined in the base image | ||
EXPOSE 7233 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Install dependencies only | ||
FROM node:20-bullseye AS deps | ||
WORKDIR /app/main | ||
COPY workers/main/package*.json ./ | ||
RUN apt-get update && apt-get install -y netcat && rm -rf /var/lib/apt/lists/* \ | ||
&& npm ci --ignore-scripts | ||
|
||
# Development image | ||
FROM node:20-bullseye AS dev | ||
# sonarcloud-disable-next-line docker:S4507 | ||
ENV NODE_ENV=development | ||
ENV DEBUG=* | ||
WORKDIR /app/main | ||
COPY --from=deps /app/main/node_modules ./node_modules | ||
RUN apt-get update && apt-get install -y netcat && rm -rf /var/lib/apt/lists/* | ||
CMD ["npx", "nodemon", "--watch", "./", "--watch", "/app/common", "--ext", "ts", "--exec", "npx", "ts-node", "src/index.ts"] | ||
|
||
# Build the app | ||
FROM node:20-bullseye AS build | ||
WORKDIR /app/main | ||
COPY --from=deps /app/main/node_modules ./node_modules | ||
COPY workers/main/ ./ | ||
RUN apt-get update && apt-get install -y netcat && rm -rf /var/lib/apt/lists/* \ | ||
&& npm run build | ||
|
||
# Production image | ||
FROM gcr.io/distroless/nodejs20-debian11 AS production | ||
ARG NODE_ENV=production | ||
ENV NODE_ENV=${NODE_ENV} | ||
WORKDIR /app/main | ||
COPY --from=build /app/main/dist ./build | ||
COPY --from=build /app/main/node_modules ./node_modules | ||
|
||
USER node | ||
CMD ["node", "build/worker.js"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.