forked from cloud-gov/pages-build-container
/
Dockerfile-exp
61 lines (51 loc) · 1.74 KB
/
Dockerfile-exp
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
49
50
51
52
53
54
55
56
57
58
59
60
61
#################
# Build Image #
#################
FROM python:3.8-buster AS builder
WORKDIR /app
RUN pip install pyinstaller staticx patchelf-wrapper
COPY ./src ./requirements.txt ./
RUN pip install -r requirements.txt
RUN \
pyinstaller -F -n tmp-build --distpath ./dist --hidden-import='pkg_resources.py2_warn' ./main.py \
&& staticx ./dist/tmp-build ./dist/build
#################
# Final Image #
#################
FROM ruby:2.7-slim
RUN \
apt-get update && apt-get install -y --no-install-recommends \
curl \
git \
gnupg \
dirmngr \
wget \
&& rm -rf /var/lib/apt/lists/*
SHELL ["/bin/bash", "-l", "-c"]
ENV RUBY_VERSION 2.7
RUN \
gpg --keyserver hkp://ipv4.pool.sks-keyservers.net \
--recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB \
&& \curl -sSL https://get.rvm.io | bash -s stable \
&& echo 'source /usr/local/rvm/scripts/rvm' >> $HOME/.bashrc
RUN \
rvm install $RUBY_VERSION \
&& rvm use --default $RUBY_VERSION \
&& echo 'rvm_silence_path_mismatch_check_flag=1' >> /etc/rvmrc
ENV NVM_DIR /usr/local/nvm
ENV NODE_DEFAULT_VERSION 10
RUN \
curl https://raw.githubusercontent.com/creationix/nvm/v0.31.3/install.sh | bash \
&& . "$NVM_DIR/nvm.sh" \
&& nvm install $NODE_DEFAULT_VERSION \
&& nvm use $NODE_DEFAULT_VERSION
# Install headless chrome
RUN \
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
&& sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \
&& apt-get update \
&& apt-get install -y google-chrome-unstable --no-install-recommends \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY --from=builder /app/dist/build .
CMD ["./build"]