-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.default
48 lines (48 loc) · 3.03 KB
/
Dockerfile.default
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# syntax=docker/dockerfile-upstream:master-experimental
FROM ghcr.io/unhookd/polly:3.0-rc1@sha256:7cc65086b101fe352a8ff83180888f0f7079b2f80139b0f39ba7b2a4cb34b168 AS base
USER root
ENV DEBIAN_FRONTEND=noninteractive LC_ALL=C.UTF-8 LANG=en_US LANGUAGE=en_US ACCEPT_EULA=y
RUN set -ex; \
(getent group alpha || groupadd --gid 121 alpha); \
(getent group tau || groupadd --gid 123 tau); \
(getent group beta || groupadd --gid 134 beta); \
(getent group docker || groupadd --gid 999 docker); \
(getent group theta || groupadd --gid 1000 theta); \
(getent group zeta || groupadd --gid 1001 zeta); \
(getent passwd app || useradd --uid 1000 --home-dir /home/app --create-home --shell /bin/bash app --groups alpha,beta,docker,theta,zeta,tau); \
(getent passwd runner || useradd --uid 1001 --home-dir /home/runner --create-home --shell /bin/bash runner --groups alpha,beta,docker,theta,zeta,tau); \
apt-get update; apt-get install -y locales locales-all; apt-get clean; \
test -e /usr/lib/locale/locale-archive || ((locale-gen --purge en_US); (echo -e "LANG=$LANG\nLANGUAGE=$LANGUAGE\n" | tee /etc/default/locale); (locale-gen $LANGUAGE); (dpkg-reconfigure locales)); \
apt-get update; apt-get install -y vim git curl apt-transport-https aptitude ca-certificates apt-utils software-properties-common docker.io build-essential libyaml-dev ruby3* libruby3* ruby-bundler rubygems-integration rake amazon-ecr-credential-helper; apt-get clean; \
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add; \
apt-add-repository "deb http://apt.kubernetes.io/ kubernetes-xenial main"; \
apt-get update; apt-get install -y kubectl; apt-get clean; \
usermod -a -G $(grep docker /etc/group | cut -d: -f3) app; \
usermod -a -G $(grep docker /etc/group | cut -d: -f3) runner; \
true;
# syntax=docker/dockerfile-upstream:master-experimental
FROM base AS gem
WORKDIR /__w/polly/polly
USER root
COPY --chown=app polly.gemspec VERSION CHANGELOG.md /__w/polly/polly/
COPY --chown=app Thorfile /__w/polly/polly/
COPY --chown=app config /__w/polly/polly/config/
COPY --chown=app lib /__w/polly/polly/lib
COPY --chown=app bin /__w/polly/polly/bin
COPY --chown=app doc /__w/polly/polly/doc
RUN set -ex; \
mkdir -p /polly/safe/git /polly/safe/run /polly/safe/tmp /polly/app /app /__w/polly/polly; \
chown -R app.alpha /home/app /polly /app /__w/polly/polly; \
chown -R app /home/app /polly /app /__w/polly/polly; \
chown -R app /home/app; \
su app -s /bin/bash -c 'cd /__w/polly/polly && gem build polly.gemspec -o /home/app/polly-latest.gem'; \
true;
# syntax=docker/dockerfile-upstream:master-experimental
FROM base AS deploy
WORKDIR /home/app
COPY --chown=app --from=gem /home/app/polly-latest.gem /home/app/polly-latest.gem
RUN set -ex; \
gem install --no-document --minimal-deps /home/app/polly-latest.gem && grep -Rn '\.gem\.' /var/lib 2>/dev/null | cut -d: -f1 | sort | uniq | xargs -I{} rm {} && rm /home/app/polly-latest.gem; \
true;
USER app
LABEL "org.opencontainers.image.description"="For pollyci"