forked from openlawteam/openlaw-client
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remove old Dockerfile and migrate in new one
- Loading branch information
Showing
4 changed files
with
28 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,66 +1,30 @@ | ||
FROM ubuntu:18.04 as base | ||
|
||
ENV DEBIAN_FRONTEND=noninteractive TERM=xterm | ||
|
||
RUN apt-get update | ||
RUN apt-get install -y locales && locale-gen en_US.UTF-8 && dpkg-reconfigure locales | ||
ENV LANGUAGE=en_US.UTF-8 LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 | ||
|
||
# Utilities | ||
RUN apt-get install -y --no-install-recommends vim less net-tools inetutils-ping wget curl git telnet nmap socat dnsutils netcat tree htop unzip sudo software-properties-common jq psmisc iproute2 python ssh rsync gettext-base | ||
|
||
# Java | ||
RUN apt-get --yes install default-jdk-headless | ||
|
||
FROM base as tools | ||
|
||
RUN apt-get install -y build-essential --fix-missing | ||
|
||
# SBT | ||
RUN curl -L -o sbt.deb http://dl.bintray.com/sbt/debian/sbt-1.2.6.deb && \ | ||
dpkg -i sbt.deb | ||
|
||
# NodeJS | ||
RUN wget -O - https://nodejs.org/dist/v10.10.0/node-v10.10.0-linux-x64.tar.gz | tar xz && \ | ||
mv node* node | ||
ENV PATH $PATH:/node/bin | ||
ARG NPM_TOKEN | ||
ENV NPM_TOKEN=${NPM_TOKEN} | ||
|
||
# Cache | ||
FROM tools as cache | ||
|
||
COPY project /src/project | ||
RUN cd /src && \ | ||
sbt update | ||
COPY package*.json /src/ | ||
RUN cd /src && \ | ||
npm --unsafe-perm ci | ||
|
||
# build | ||
COPY . /src/ | ||
WORKDIR /src | ||
|
||
# sbt build | ||
FROM cache as build_sbt | ||
|
||
# The scala-builder stage compiles Openlaw.scala into JavaScript output, | ||
# via the ScalaJS stuff. There are some other sbt dependencies that also | ||
# get bundled up into the output, including openlaw-core. | ||
FROM openlaw/scala-builder:node as builder | ||
# 1. install plugins and dependencies. | ||
# | ||
# we do this in two different stages to take advantage of layer caching, with | ||
# the assumption that build deps are more often changed than plugins. | ||
COPY project ./project | ||
RUN sbt update #( installing plugins... ) | ||
COPY build.sbt . | ||
RUN sbt update #( installing deps... ) | ||
# 2. compile src code to javascript | ||
COPY src src | ||
RUN sbt fullOptJS | ||
# -> creates target/scala-2.12/client.js | ||
|
||
# npm build | ||
FROM build_sbt as build_npm | ||
|
||
RUN npm --unsafe-perm ci | ||
RUN npm --unsafe-perm run build_prod | ||
|
||
FROM build_npm as test | ||
|
||
# Re-enable once tests are working again | ||
# RUN cd /src && \ | ||
# SBT_OPTS="-Xmx4G" sbt test | ||
|
||
FROM test as release | ||
|
||
ARG RELEASE | ||
ENV RELEASE=${RELEASE} | ||
|
||
RUN if [ "$RELEASE" = "true" ]; then npm run release; fi | ||
# TODO: written explanation of what happens in this stage. | ||
FROM node:10-alpine as packager | ||
WORKDIR /src | ||
COPY package*.json ./ | ||
RUN npm ci | ||
COPY --from=builder /src/target/scala-2.12/client.js target/scala-2.12/client.js | ||
COPY js js | ||
COPY *.md *.js .babelrc ./ | ||
RUN npm run build_prod | ||
|
||
# The scripts folder now contains any shell scripts designed to be run inside | ||
# the container itself. | ||
COPY scripts scripts |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters