How to run semantic-release as a Docker command-line application? #1847
-
I want to run semantic-release without the need to setup node locally. I want to run semantic release in docker but without executing desired functionality: I want to run the following command inside a git-repository on any machine that has docker as single dependency:
Dockerfile
This works, but unfortunately, git modifies my I know that I can fix the permissions afterward with Is someone using a similar setup and knows a clean solution for this? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
You can add |
Beta Was this translation helpful? Give feedback.
-
Thank you @bigbrozer for the tips. I was able to solve my issue but there have been two problems:
I solved this problem with the following files and commands:
FROM node:14-alpine
# Node has UID=1000 which is the default UID for ubuntu which can lead to conflicts.
# This image is intended to be run by the USER and UID of the host system, so the
# default node user is not required.
RUN deluser --remove-home node
RUN apk add --no-cache git
WORKDIR /usr/src/app
RUN npm install semantic-release @semantic-release/exec
ADD semantic-release.sh ./semantic-release.sh
CMD sh semantic-release.sh
#!/bin/sh
echo "adding user: ${USER} with UID: ${UID}"
# -D = without login password
adduser ${USER} -u ${UID} -D
echo "giving the new user ownership of application folder"
chown -R ${USER}:${USER} /usr/src/app
su ${USER} -c "npx semantic-release --no-ci --extends ./aws/semantic-release.js --repository-url ${REPO}
These are my project-specific settings that I don't want to disclose here. Running
|
Beta Was this translation helpful? Give feedback.
Thank you @bigbrozer for the tips. I was able to solve my issue but there have been two problems:
I solved this problem with the following files and commands:
Dockerfile