mirror of
https://github.com/outbackdingo/firezone.git
synced 2026-01-27 18:18:55 +00:00
build from workflow
This commit is contained in:
6
.github/workflows/main.yml
vendored
6
.github/workflows/main.yml
vendored
@@ -69,7 +69,11 @@ jobs:
|
||||
elixir-version: "1.11.1"
|
||||
otp-version: "23.1.1"
|
||||
- name: Build packages
|
||||
run: which docker
|
||||
run: |
|
||||
short_sha=$(git rev-parse --short HEAD)
|
||||
docker build -t fireguard:$short_sha -f pkg/Dockerfile .
|
||||
cid=$(docker create fireguard:$short_sha)
|
||||
docker cp ${cid}:/build/fireguard_0.1.0-1_amd64.deb .
|
||||
- name: upload package
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
|
||||
@@ -1,11 +1,22 @@
|
||||
# This Dockerfile builds release packages
|
||||
FROM ubuntu:20.04
|
||||
FROM hexpm/elixir:1.11.1-erlang-23.1.1-ubuntu-focal-20200703 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/*
|
||||
@@ -15,6 +26,37 @@ ENV LANG en_US.UTF-8
|
||||
ENV LANGUAGE en_US:en
|
||||
ENV LC_ALL en_US.UTF-8
|
||||
|
||||
WORKDIR /app
|
||||
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 ./scripts/build.sh
|
||||
RUN mix release fireguard
|
||||
|
||||
RUN mkdir -p pkg/debian/opt
|
||||
RUN mv _build/prod/rel/fireguard pkg/debian/opt/fireguard
|
||||
|
||||
ENV DATABASE_URL ecto://dummy@localhost/dummy
|
||||
ENV SECRET_KEY_BASE dummy
|
||||
RUN ./pkg/debian/opt/fireguard/bin/fireguard eval 'IO.puts "Hello World!"'
|
||||
|
||||
RUN cd pkg && dpkg-deb --build debian
|
||||
RUN mv pkg/debian.deb fireguard_0.1.0-1_amd64.deb
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
export root=`pwd`
|
||||
|
||||
apt-get update -q && \
|
||||
apt-get install -y --no-install-recommends \
|
||||
build-essential \
|
||||
git \
|
||||
curl \
|
||||
libssl-dev \
|
||||
automake \
|
||||
lintian \
|
||||
dpkg-dev \
|
||||
gnupg \
|
||||
autoconf \
|
||||
libncurses5-dev \
|
||||
unzip \
|
||||
zlib1g-dev
|
||||
|
||||
# Only install runtimes if not running in Github action
|
||||
if [ -z "${CI+1}" ]; then
|
||||
bash scripts/install_runtimes.sh
|
||||
fi
|
||||
|
||||
# Set build env vars
|
||||
export MIX_ENV=prod
|
||||
|
||||
# Install dependencies
|
||||
mix local.hex --force
|
||||
mix local.rebar --force
|
||||
mix do deps.get, deps.compile
|
||||
|
||||
# Compile assets
|
||||
cd $root/apps/fg_http/assets && npm i --progress=false --no-audit --loglevel=error
|
||||
cd $root/apps/fg_http/assets && npm run deploy && cd .. && mix phx.digest
|
||||
|
||||
# Build the release
|
||||
cd $root && mix release fireguard
|
||||
|
||||
# Move release for packaging
|
||||
mv ./_build/prod/rel/fireguard ./pkg/debian/opt/fireguard
|
||||
|
||||
# Smoke test
|
||||
export DATABASE_URL=ecto://dummy@localhost/dummy
|
||||
export SECRET_KEY_BASE=dummy
|
||||
./pkg/debian/opt/fireguard/bin/fireguard eval 'IO.puts "hello world"'
|
||||
|
||||
# Build package
|
||||
cd $root/pkg && dpkg-deb --build debian
|
||||
mv pkg/debian.deb fireguard_0.1.0-1_amd64.deb
|
||||
|
||||
# TODO: This reports too many issues... :-(
|
||||
# RUN lintian fireguard_0.1.0-1_amd64.deb
|
||||
@@ -1,21 +0,0 @@
|
||||
#!/usr/bin/env sh
|
||||
set -e
|
||||
|
||||
git clone --depth 1 https://github.com/asdf-vm/asdf.git $HOME/.asdf
|
||||
export PATH="${PATH}:${HOME}/.asdf/shims:${HOME}/.asdf/bin"
|
||||
echo '. $HOME/.asdf/asdf.sh' >> $HOME/.bashrc
|
||||
echo '. $HOME/.asdf/asdf.sh' >> $HOME/.bash_profile
|
||||
|
||||
bash $HOME/.asdf/asdf.sh
|
||||
|
||||
# Install project runtimes
|
||||
asdf plugin-add erlang && \
|
||||
asdf plugin-update erlang && \
|
||||
asdf plugin-add elixir && \
|
||||
asdf plugin-update elixir && \
|
||||
asdf plugin-add nodejs && \
|
||||
asdf plugin-update nodejs && \
|
||||
asdf plugin-add python && \
|
||||
asdf plugin-update python
|
||||
bash -c '${ASDF_DATA_DIR:=$HOME/.asdf}/plugins/nodejs/bin/import-release-team-keyring'
|
||||
asdf install
|
||||
Reference in New Issue
Block a user