Files
firezone/pkg/Dockerfile
2020-11-13 13:52:30 -06:00

63 lines
1.8 KiB
Docker

# This Dockerfile builds release packages.
# **NOTE**: This is not recommended, as it's possible the deployment
# production environment will diff from the image environment here,
# even if the OS and kernel versions match.
# As such, this script has been deprecated in favor of building the release
# in the production environment.
FROM hexpm/elixir:1.11.2-erlang-23.1.2-ubuntu-focal-20201008 AS build
# Setup to run build script
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update -q && \
apt-get install -y --no-install-recommends \
ca-certificates \
build-essential \
git \
dpkg-dev \
libssl-dev \
automake \
gnupg \
curl \
autoconf \
libncurses5-dev \
unzip \
zlib1g-dev \
locales && \
apt-get clean && \
rm -rf /tmp/* /var/tmp/*
RUN sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && \
locale-gen
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash -
RUN apt-get install nodejs
ENV MIX_ENV prod
WORKDIR /build
RUN mix local.hex --force && \
mix local.rebar --force
COPY mix.exs mix.lock ./
COPY config config
COPY apps/fg_http/mix.exs ./apps/fg_http/
COPY apps/fg_wall/mix.exs ./apps/fg_wall/
COPY apps/fg_vpn/mix.exs ./apps/fg_vpn/
RUN mix do deps.get, deps.compile
COPY apps/fg_http/assets/package.json apps/fg_http/assets/package-lock.json ./apps/fg_http/assets/
RUN cd apps/fg_http/assets && npm ci --progress=false --no-audit --loglevel=error
COPY apps/fg_http/priv apps/fg_http/priv
COPY apps/fg_http/assets apps/fg_http/assets
RUN npm run --prefix ./apps/fg_http/assets deploy && \
cd apps/fg_http && mix phx.digest
COPY . .
RUN mix release fireguard
RUN mkdir -p pkg/debian/opt
RUN mv _build/prod/rel/fireguard pkg/debian/opt/fireguard
RUN cd pkg && dpkg-deb --build debian