Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
plausible-analytics
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
varac-projects
plausible-analytics
Commits
59acd4c7
Unverified
Commit
59acd4c7
authored
4 years ago
by
Caleb Woodbine
Committed by
GitHub
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Update container image to run as non root (#352)
parent
ceaf39c2
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
.gitlab/build-scripts/docker-entrypoint.sh
+2
-7
2 additions, 7 deletions
.gitlab/build-scripts/docker-entrypoint.sh
Dockerfile
+1
-16
1 addition, 16 deletions
Dockerfile
with
3 additions
and
23 deletions
.gitlab/build-scripts/docker-entrypoint.sh
+
2
−
7
View file @
59acd4c7
#!/bin/bash
set
-e
chmod
a+x /app/
*
.sh
if
[[
"
$1
"
=
'run'
]]
;
then
exec
gosu plausibleuser
/app/bin/plausible start
/app/bin/plausible start
elif
[[
"
$1
"
=
'db'
]]
;
then
exec
gosu plausibleuser /app/
"
$2
"
.sh
else
exec
"
$@
"
/app/
"
$2
"
.sh
fi
exec
"
$@
"
...
...
This diff is collapsed.
Click to expand it.
Dockerfile
+
1
−
16
View file @
59acd4c7
...
...
@@ -6,7 +6,6 @@ FROM elixir:1.10.3 as buildcontainer
# preparation
ARG
APP_VER=0.0.1
ENV
GOSU_VERSION 1.11
ENV
MIX_ENV=prod
ENV
NODE_ENV=production
ENV
APP_VERSION=$APP_VER
...
...
@@ -23,20 +22,6 @@ RUN apt-get update && \
RUN
apt-get
install
-y
--no-install-recommends
ca-certificates wget
\
&&
apt-get
install
-y
--install-recommends
gnupg2 dirmngr
# grab gosu for easy step-down from root
RUN
set
-x
\
&&
dpkgArch
=
"
$(
dpkg
--print-architecture
|
awk
-F-
'{ print $NF }'
)
"
\
&&
wget
-O
/usr/local/bin/gosu
"https://github.com/tianon/gosu/releases/download/
$GOSU_VERSION
/gosu-
$dpkgArch
"
\
&&
wget
-O
/usr/local/bin/gosu.asc
"https://github.com/tianon/gosu/releases/download/
$GOSU_VERSION
/gosu-
$dpkgArch
.asc"
\
&&
export
GNUPGHOME
=
"
$(
mktemp
-d
)
"
\
&&
gpg
--keyserver
ha.pool.sks-keyservers.net
--recv-keys
B42F6819007F00F88E364FD4036A9C25BF357DD4
\
&&
gpg
--batch
--verify
/usr/local/bin/gosu.asc /usr/local/bin/gosu
\
&&
command
-v
gpgconf
&&
gpgconf
--kill
all
||
:
\
&&
rm
-r
"
$GNUPGHOME
"
/usr/local/bin/gosu.asc
\
&&
chmod
+x /usr/local/bin/gosu
\
&&
gosu
--version
\
&&
gosu nobody
true
COPY
mix.exs ./
COPY
mix.lock ./
RUN
mix local.hex
--force
&&
\
...
...
@@ -82,9 +67,9 @@ COPY .gitlab/build-scripts/docker-entrypoint.sh /entrypoint.sh
RUN
chmod
a+x /entrypoint.sh
&&
\
useradd
-d
/app
-u
1000
-s
/bin/bash
-m
plausibleuser
COPY
--from=buildcontainer /usr/local/bin/gosu /usr/local/bin/gosu
COPY
--from=buildcontainer /app/_build/prod/rel/plausible /app
RUN
chown
-R
plausibleuser:plausibleuser /app
USER
plausibleuser
WORKDIR
/app
ENTRYPOINT
["/entrypoint.sh"]
CMD
["run"]
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment