-
Notifications
You must be signed in to change notification settings - Fork 384
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3359 from csordasmarton/web_docker_image_hooks
[docker] Web docker image hooks
- Loading branch information
Showing
4 changed files
with
38 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,29 @@ | ||
#!/bin/bash | ||
|
||
if [ "$(id -u)" == '0' ]; then | ||
# Set PostgreSQL password file from secrets. | ||
pgpass=/run/secrets/pgpass | ||
if [ -f $pgpass ]; then | ||
cp $pgpass /.pgpass | ||
chmod 0600 /.pgpass | ||
chown codechecker:codechecker /.pgpass | ||
export PGPASSFILE=/.pgpass | ||
fi | ||
USER_ID=$($USER) | ||
USER_GROUP="$(id -g)" | ||
WORKSPACE_DIR="/workspace" | ||
PGPASS_FILE=$WORKSPACE_DIR/.pgpass | ||
|
||
# Change the owner of the workspace directory | ||
mkdir -p /workspace | ||
chown codechecker:codechecker /workspace | ||
if [ "$(id -u)" = '0' ]; then | ||
# Create workspace directory and change the permission to 'codechecker' user | ||
# if this directory doesn't exists. | ||
if [ ! -d $WORKSPACE_DIR ]; then | ||
mkdir -p $WORKSPACE_DIR | ||
chown -R codechecker:codechecker $WORKSPACE_DIR | ||
fi | ||
|
||
# Execute this script again with codechecker user. | ||
exec gosu codechecker "$0" "$@" | ||
fi | ||
|
||
# Set PostgreSQL password file from secrets. | ||
pgpass=/run/secrets/pgpass | ||
if [ -f $pgpass ]; then | ||
cat $pgpass > ${PGPASS_FILE} | ||
chmod 0600 ${PGPASS_FILE} | ||
chown ${USER_ID}:${USER_GROUP} ${PGPASS_FILE} | ||
export PGPASSFILE=${PGPASS_FILE} | ||
fi | ||
|
||
exec "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
|
||
# This script can be used to run extra commands before the CodeChecker package | ||
# is built. It can be useful when someone wants to patch some file and to | ||
# create an internal docker image by using our docker image file. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
|
||
# This script can be used to run extra commands 'after' the CodeChecker package | ||
# is built. It can be useful when someone wants to add some extra files to the | ||
# built CodeChecker package. |