Skip to content

Commit

Permalink
feat: build app docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
matthieu-foucault committed Jun 9, 2020
1 parent 45ca090 commit a9a5d54
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
app/node_modules
app/.next
54 changes: 54 additions & 0 deletions app/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
FROM alpine

ENV SUMMARY="A tools image for the cas-ciip-portal project" \
DESCRIPTION="This image contains the development tool needed to build the ciip portal repository. The tools are installed via asdf (when available)"

LABEL summary="$SUMMARY" \
description="$DESCRIPTION" \
io.k8s.description="$DESCRIPTION" \
io.k8s.display-name="CAS CIIP Portal tools" \
io.openshift.tags="s2i,cas,ciip,builder-image" \
name="cas-ciip-portal-tools" \
version="1" \
maintainer="Matthieu Foucault <matthieu@button.is>"

RUN apk --no-cache add bash git build-base automake autoconf readline-dev \
ncurses-dev openssl-dev yaml-dev libxslt-dev libffi-dev libtool \
unixodbc-dev openssh-client curl gnupg coreutils

RUN adduser --home /home/ciip --system ciip -G root
USER ciip
WORKDIR /home/ciip
COPY app/ /home/ciip/

RUN git clone https://github.com/asdf-vm/asdf.git ~/asdf --branch v0.7.4
RUN cd ~/asdf && git checkout v0.7.4
ENV BASH_ENV="/home/asdf/asdf.sh"
# Because asdf is loaded via BASH_ENV, all commands using adsf need to be executed using /usr/bin/env bash -c
SHELL ["/usr/bin/env", "bash", "-c"]

COPY .tool-versions /home/ciip/.tool-versions
# The app only needs yarn and node
RUN sed -i -nr '/node|yarn/p' .tool-versions
RUN cat ~/.tool-versions | cut -f 1 -d ' ' | xargs -n 1 asdf plugin-add
RUN asdf plugin-update --all
# The nodejs release team keyring is needed to install the asdf node plugin
RUN ~/.asdf/plugins/nodejs/bin/import-release-team-keyring

RUN asdf install
RUN asdf reshim

RUN yarn install --frozen-lockfile --production=false && \
yarn build:relay && \
yarn build:next && \
yarn build:storybook && \
yarn install --frozen-lockfile --production=true && \
yarn cache clean


# Make everything in the tools home group-writable, to accomodate anyuid (in OpenShift)
USER root
COPY .bin/fix-permissions /usr/bin/fix-permissions
RUN fix-permissions /home/tools

ENTRYPOINT ["bash"]

0 comments on commit a9a5d54

Please sign in to comment.