Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
writeFrame
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
writeFrame
Commits
c291f0f8
Commit
c291f0f8
authored
Apr 02, 2019
by
Lennart Weller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed secondary chart and instead use modified entrypoint
parent
b53d2ed6
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
6 additions
and
109 deletions
+6
-109
.travis.yml
.travis.yml
+0
-1
Dockerfile
chart/Dockerfile
+0
-61
chart-entrypoint.sh
resources/chart-entrypoint.sh
+0
-44
docker-entrypoint.sh
resources/docker-entrypoint.sh
+6
-3
No files found.
.travis.yml
View file @
c291f0f8
...
...
@@ -9,7 +9,6 @@ env:
matrix
:
-
BASE=debian
-
BASE=alpine
-
BASE=chart
before_install
:
-
sudo apt-get -qq update
...
...
chart/Dockerfile
deleted
100644 → 0
View file @
b53d2ed6
FROM
node:8.15.1
# Build arguments to change source url, branch or tag
ARG
CODIMD_REPOSITORY=https://github.com/codimd/server.git
ARG
VERSION=master
# Set some default config variables
ENV
DEBIAN_FRONTEND noninteractive
ENV
DOCKERIZE_VERSION v0.6.1
ENV
NODE_ENV=production
RUN
wget https://github.com/jwilder/dockerize/releases/download/
$DOCKERIZE_VERSION
/dockerize-linux-amd64-
$DOCKERIZE_VERSION
.tar.gz
&&
\
tar
-C
/usr/local/bin
-xzvf
dockerize-linux-amd64-
$DOCKERIZE_VERSION
.tar.gz
&&
\
rm
dockerize-linux-amd64-
$DOCKERIZE_VERSION
.tar.gz
# Add configuraton and init files
COPY
resources/config.json resources/.sequelizerc /files/
COPY
resources/chart-entrypoint.sh /usr/local/bin/chart-entrypoint.sh
RUN
apt-get update
&&
\
apt-get
install
-y
git build-essential jq
&&
\
# Add fonts for PDF export
apt-get install -y fonts-noto && \
# Clone the source
git clone --depth 1 --branch "$VERSION" "$CODIMD_REPOSITORY" /codimd && \
# Print the cloned version and clean up git files
cd /codimd && \
git log --pretty=format:'%ad %h %d' --abbrev-commit --date=short -1 && echo && \
git rev-parse HEAD > /tmp/gitref && \
rm -rf /codimd/.git && \
# Mime the git repository for fullversion
mkdir /codimd/.git && \
mv /tmp/gitref /codimd/.git/HEAD && \
jq ".repository.url = \"${CODIMD_REPOSITORY}\"" /codimd/package.json > /codimd/package.new.json && \
mv /codimd/package.new.json /codimd/package.json && \
# Symlink configuration files
rm -f /codimd/config.json && ln -s /files/config.json /codimd/config.json && \
rm -f /codimd/.sequelizerc && ln -s /files/.sequelizerc /codimd/.sequelizerc && \
# Install NPM dependencies and build project
yarn install --pure-lockfile && \
yarn install --production=false --pure-lockfile && \
npm run build && \
# Clean up this layer
yarn install && \
yarn cache clean && \
apt-get remove -y --auto-remove build-essential git jq && \
apt-get clean && apt-get purge && rm -r /var/lib/apt/lists/* && \
# Create codimd user
adduser --uid 10000 --home /codimd/ --disabled-password --system codimd && \
chown -R codimd /codimd/
WORKDIR
/codimd
EXPOSE
3000
USER
codimd
ENTRYPOINT
["/usr/local/bin/chart-entrypoint.sh"]
CMD
["node", "app.js"]
resources/chart-entrypoint.sh
deleted
100755 → 0
View file @
b53d2ed6
#!/bin/sh
if
[
"
$HMD_DB_URL
"
!=
""
]
&&
[
"
$CMD_DB_URL
"
=
""
]
;
then
CMD_DB_URL
=
"
$HMD_DB_URL
"
fi
if
[
"
$HMD_IMAGE_UPLOAD_TYPE
"
!=
""
]
&&
[
"
$CMD_IMAGE_UPLOAD_TYPE
"
=
""
]
;
then
CMD_IMAGE_UPLOAD_TYPE
=
"
$HMD_IMAGE_UPLOAD_TYPE
"
fi
if
[
"
$CMD_DB_URL
"
=
""
]
;
then
CMD_DB_URL
=
"postgres://hackmd:hackmdpass@hackmdPostgres:5432/hackmd"
fi
export
CMD_DB_URL
DB_SOCKET
=
$(
echo
${
CMD_DB_URL
}
|
sed
-e
's/.*:\/\//\/\//'
-e
's/.*\/\/[^@]*@//'
-e
's/\/.*$//'
)
if
[
"
$DB_SOCKET
"
!=
""
]
;
then
dockerize
-wait
tcp://
${
DB_SOCKET
}
-timeout
30s
fi
./node_modules/.bin/sequelize db:migrate
# Print warning if local data storage is used but no volume is mounted
[
"
$CMD_IMAGE_UPLOAD_TYPE
"
=
"filesystem"
]
&&
{
mountpoint
-q
./public/uploads
||
{
echo
"
#################################################################
### ###
### !!!WARNING!!! ###
### ###
### Using local uploads without persistence is ###
### dangerous. You'll loose your data on ###
### container removal. Check out: ###
### https://docs.docker.com/engine/tutorials/dockervolumes/ ###
### ###
### !!!WARNING!!! ###
### ###
#################################################################
"
;
}
;
}
# run
exec
"
$@
"
resources/docker-entrypoint.sh
View file @
c291f0f8
#!/bin/sh
# Use gosu if the container started with root privileges
[
$(
id
-u
)
-eq
0]
&&
GOSU
=
"gosu codimd"
||
GOSU
=
""
if
[
"
$HMD_DB_URL
"
!=
""
]
&&
[
"
$CMD_DB_URL
"
=
""
]
;
then
CMD_DB_URL
=
"
$HMD_DB_URL
"
fi
...
...
@@ -20,7 +23,7 @@ if [ "$DB_SOCKET" != "" ]; then
dockerize
-wait
tcp://
${
DB_SOCKET
}
-timeout
30s
fi
gosu codimd
node_modules/.bin/sequelize db:migrate
$GOSU
./
node_modules/.bin/sequelize db:migrate
# Print warning if local data storage is used but no volume is mounted
[
"
$CMD_IMAGE_UPLOAD_TYPE
"
=
"filesystem"
]
&&
{
mountpoint
-q
./public/uploads
||
{
...
...
@@ -41,7 +44,7 @@ gosu codimd node_modules/.bin/sequelize db:migrate
}
;
}
# Change owner and permission if filesystem backend is used
if
[
"
$CMD_IMAGE_UPLOAD_TYPE
"
=
"filesystem"
]
;
then
if
[
-z
$GOSU
&&
"
$CMD_IMAGE_UPLOAD_TYPE
"
=
"filesystem"
]
;
then
chown
-R
codimd ./public/uploads
chmod
700 ./public/uploads
fi
...
...
@@ -50,4 +53,4 @@ fi
sleep
3
# run
exec
gosu codimd
"
$@
"
exec
$GOSU
"
$@
"
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment