Skip to content

Commit

Permalink
Merge pull request #14 from voxpupuli/update_build
Browse files Browse the repository at this point in the history
feat: do multi stage build, remove package-lock.json, add usage for gitlab to README
  • Loading branch information
rwaffen authored Sep 24, 2024
2 parents 81c5287 + 9388769 commit 5c7ac2f
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 16,303 deletions.
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

0 comments on commit 5c7ac2f

Please sign in to comment.