* feat: Use hybrid approach depending on runner * Fix tag * Update dist * Add fetch depth to test * Add dependcy on docker-build job for test action * Improve branch extraction naming, add npm scripts to bump docker tags * Pass inputs along * Run tests on workflow_run completed * Update workflow run trigger * Fix fetch-depth * Update comment * Update workflow naming * Update workflow names * Merge test.yml into build.yml to run tests after building * Always install node/npm on non Linux runners, update development docs * Fail the job if docker tag matches MAJOR.MINOR.PATCH naming * Some cleanup * Test with major.minor.patch tag * Rework error message * Update development doc * Add logic to commit `master` docker tag on master runs * Allow linting in parallel * Add pre-commit to the repo * Add Makefile to install pre-commit and yarrn deps * Skip pre-commit in action when committing the master tag back * Add note on `yarn set-docker-tag-from-branch` to development doc * Add formatting and linting to pre-commit * Mark e2e tests in build.yml better * Don't pass filenames to local hooks, fix dockerfile casing * Add changelog
33 lines
1.1 KiB
Docker
33 lines
1.1 KiB
Docker
# The multi stage set up *saves* up image size by avoiding the dev dependencies
|
|
# required to produce dist/
|
|
FROM node:18-alpine AS builder
|
|
WORKDIR /app
|
|
# This layer will invalidate upon new dependencies
|
|
COPY package.json yarn.lock ./
|
|
RUN export YARN_CACHE_FOLDER="$(mktemp -d)" \
|
|
&& yarn install --frozen-lockfile --quiet \
|
|
&& rm -r "$YARN_CACHE_FOLDER"
|
|
# If there's some code changes that causes this layer to
|
|
# invalidate but it shouldn't, use .dockerignore to exclude it
|
|
COPY . .
|
|
RUN yarn build
|
|
|
|
FROM node:18-alpine AS app
|
|
COPY package.json yarn.lock /action-release/
|
|
# On the builder image, we install both types of dependencies rather than
|
|
# just the production ones. This generates /action-release/node_modules
|
|
RUN export YARN_CACHE_FOLDER="$(mktemp -d)" \
|
|
&& cd /action-release \
|
|
&& yarn install --frozen-lockfile --production --quiet \
|
|
&& rm -r "$YARN_CACHE_FOLDER"
|
|
|
|
# Copy the artifacts from `yarn build`
|
|
COPY --from=builder /app/dist /action-release/dist/
|
|
RUN chmod +x /action-release/dist/index.js
|
|
|
|
RUN printf '[safe]\n directory = *\n' > /etc/gitconfig
|
|
|
|
COPY entrypoint.sh /entrypoint.sh
|
|
RUN chmod +x /entrypoint.sh
|
|
ENTRYPOINT ["/entrypoint.sh"]
|