Skip to content
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

feat: do multi stage build, remove package-lock.json, add usage for gitlab to README #14

Merged
merged 1 commit into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 13 additions & 14 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
FROM node:22.9.0-alpine3.20
FROM node:22.8.0-alpine3.20 AS build

WORKDIR /npm
COPY package.json /npm

RUN npm install

###############################################################################

FROM node:22.8.0-alpine3.20 AS final

LABEL org.label-schema.maintainer="Voxpupuli Team <[email protected]>" \
org.label-schema.vendor="Voxpupuli" \
Expand All @@ -9,21 +18,11 @@ LABEL org.label-schema.maintainer="Voxpupuli Team <[email protected]>" \
org.label-schema.schema-version="1.0" \
org.label-schema.dockerfile="/Dockerfile"

RUN apk update \
&& apk upgrade \
&& apk add --no-cache --update git git-lfs openssh-client

# TODO: https://github.com/voxpupuli/container-semantic-release/issues/3
# RUN addgroup -g 1001 release && adduser -G release -u 1001 -D semantic \
# && mkdir -p /npm /data \
# && chown -R semantic:release /npm /data
# USER semantic
RUN apk update && apk upgrade \
&& apk add --no-cache --update git git-lfs openssh-client bash

WORKDIR /npm
COPY Dockerfile /
COPY package.json package-lock.json /npm/

RUN npm ci
COPY --from=build /npm /npm

WORKDIR /data

Expand Down
53 changes: 24 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,33 +8,28 @@

This container can be used to create project releases. It encapsulates semantic-release and all necessary plugins.

## Development

### How to generate package.json and package-lock.json

```shell
docker run --rm -it -v $PWD:/data --entrypoint sh node:22.8.0-alpine3.20

mkdir /npm
cd /npm

npm install \
semantic-release \
@bobvanderlinden/semantic-release-pull-request-analyzer \
@semantic-release/changelog \
@semantic-release/commit-analyzer \
@semantic-release/exec \
@semantic-release/git \
@semantic-release/github \
@semantic-release/gitlab \
@semantic-release/release-notes-generator \
semantic-release-commits-lint \
semantic-release-github-pullrequest \
semantic-release-jira-notes \
semantic-release-license \
semantic-release-major-tag \
semantic-release-pypi \
semantic-release-replace-plugin

cp package.json package-lock.json /data
## Usage

### Gitlab

This is a example to use this container in Gitlab.
It requires, that you have:

- A `.releaserc` file, written in YAML or JSON, with optional extensions: `.yaml` / `.yml` / `.json` / `.js` / `.cjs` / `.mjs`
- A `release.config.(js|cjs|.mjs)` file that exports an object
- A `release` key in the project's `package.json` file

```yaml
---
release:
stage: release
image:
name: ghcr.io/voxpupuli/semantic-release:latest
entrypoint: [""] # overwrite entrypoint - gitlab-ci quirk
script:
- semantic-release
only:
- master
- main
- production
```
Loading
Loading