Skip to content

Commit e94e5df

Browse files
committed
Run container under kubernetes properly as non-root
1 parent ca74c71 commit e94e5df

File tree

3 files changed

+10
-16
lines changed

3 files changed

+10
-16
lines changed

Dockerfile

+9-8
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
FROM quay.io/perl/base-os:v3.3
1+
#FROM quay.io/perl/base-os:v3.10-2
2+
FROM quay.io/perl/base-os:master
23

34
# Note that this only builds dependencies and such, it doesn't
45
# actually include the site code etc itself. The site code
@@ -7,15 +8,15 @@ FROM quay.io/perl/base-os:v3.3
78

89
# Cache buster for occasionally resetting the cached images even if
910
# the base doesn't change.
10-
ENV LAST_UPDATED 2018-07-17
11+
ENV LAST_UPDATED 2019-11-04
1112

1213
USER root
1314

1415
RUN apk update; apk upgrade ; apk add curl git \
1516
perl-dev wget make \
1617
inotify-tools \
1718
expat-dev zlib-dev libressl-dev libressl \
18-
mariadb-client mariadb-client-libs mariadb-dev build-base
19+
mariadb-client mariadb-dev build-base
1920

2021
ADD .modules /tmp/modules.txt
2122
ADD combust/.modules /tmp/combust-modules.txt
@@ -25,18 +26,18 @@ RUN curl -sfLo /usr/bin/cpanm https://raw.githubusercontent.com/miyagawa/cpanmin
2526
RUN grep -hv '^#' /tmp/combust-modules.txt /tmp/modules.txt | \
2627
cpanm -n; rm -fr ~/.cpanm; rm -f /tmp/modules /tmp/combust-modules.txt
2728

28-
ENV CBROOTLOCAL=/perlweb/
29-
ENV CBROOT=/perlweb/combust
30-
ENV CBCONFIG=/perlweb/combust.docker.conf
29+
ENV CBROOTLOCAL=/git/perlweb/
30+
ENV CBROOT=/git/perlweb/combust
31+
ENV CBCONFIG=/git/perlweb/combust.docker.conf
3132

3233
# optional; in production we load the data into the container
3334
#VOLUME /perlweb
3435

35-
WORKDIR /perlweb
36+
WORKDIR /git/perlweb
3637
EXPOSE 8235
3738

3839
RUN addgroup perlweb && adduser -D -G perlweb perlweb
39-
RUN chown perlweb:perlweb /perlweb
40+
RUN chown perlweb:perlweb /git/perlweb
4041

4142
RUN mkdir /var/tmp/perlweb; chown perlweb:perlweb /var/tmp/perlweb; chmod 700 /var/tmp/perlweb
4243

docker/container-run.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# for running under docker for testing
44

5-
cd /perlweb
5+
cd /git/perlweb
66
ls -latr
77
if [ -e .git ]; then
88
echo Already has a git checkout

docker/kube-start

-7
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,5 @@
11
#!/bin/sh
22

3-
# we have to start the image as root just to make
4-
# this possible. An alternative would be to make it
5-
# into the image and use /git/perlweb when running
6-
# the image just under docker for testing ...
7-
rmdir /perlweb
8-
ln -s /git/perlweb /perlweb
9-
103
# use this as 'entrypoint' / command in the kubernetes container
114
while [ ! -f $1 ]
125
do

0 commit comments

Comments
 (0)