Skip to content

Commit

Permalink
Create no-entrypoint dockerfile
Browse files Browse the repository at this point in the history
Merge in CI/github-actions-runner from fix/entrypoint-2 to master

* commit '97313607cc5b49a716f70e0c8261b9538606fc76':
  create no-entrypoint dockerfile
  • Loading branch information
maximtop committed Apr 26, 2024
2 parents b61610c + 9731360 commit af5088a
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 9 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,9 @@ jobs:
uses: docker/build-push-action@v5
with:
context: .
file: no-entrypoint.Dockerfile
push: true
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}-no-entrypoint
labels: ${{ steps.meta.outputs.labels }}
build-args: |
VERSION=${GITHUB_REF##*/}
WITH_ENTRYPOINT=false
build-args: "VERSION=${GITHUB_REF##*/}"
7 changes: 1 addition & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,4 @@ FROM node:20.12.2-bookworm-slim AS runtime
COPY --from=builder /app/dist/bin/index.js /usr/local/bin/github-actions-runner
RUN chmod +x /usr/local/bin/github-actions-runner

ARG WITH_ENTRYPOINT=true
# Conditionally add ENTRYPOINT based on build argument
RUN if [ "$WITH_ENTRYPOINT" = "true" ]; then \
echo "Adding entrypoint"; \
ENTRYPOINT ["github-actions-runner"]; \
fi
ENTRYPOINT ["github-actions-runner"]
27 changes: 27 additions & 0 deletions no-entrypoint.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Stage 1: Build environment
FROM node:20.12.2-bookworm-slim AS builder

# Install PNPM globally with a specific version
RUN npm install -g [email protected]

# Set the working directory in the Docker image
WORKDIR /app

# Copy package.json and pnpm-lock.yaml first for better caching
COPY package.json pnpm-lock.yaml ./

# Install dependencies
RUN pnpm install --frozen-lockfile

# Copy the rest of your app's source code
COPY . .

# Build your app
RUN pnpm run build

# Stage 2: Runtime environment
FROM node:20.12.2-bookworm-slim AS runtime

# Copy only the built executable and set permissions
COPY --from=builder /app/dist/bin/index.js /usr/local/bin/github-actions-runner
RUN chmod +x /usr/local/bin/github-actions-runner

0 comments on commit af5088a

Please sign in to comment.