Merge pull request #6 from CloudFire-LLC/remove-docker

Remove docker-compose in favor of packer
This commit is contained in:
Jamil
2020-04-28 22:17:25 -07:00
committed by GitHub
6 changed files with 12 additions and 170 deletions

View File

@@ -1,10 +0,0 @@
_build/
deps/
.git/
.gitignore/
Dockerfile
Makefile
README*
LICENSE
test/
node_modules

View File

@@ -41,36 +41,28 @@ jobs:
- name: Run Tests
run: mix test
# 2. Build and Push App Image
build-app-image:
# 2. Build VM image
build-vm:
needs: unit-integration-test
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- uses: azure/docker-login@v1
with:
login-server: docker.pkg.github.com
username: $GITHUB_ACTOR
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
- name: Build VM Image
# uses: operatehappy/packer-github-action
# with:
# command: build
# arguments: "-color=false -on-error=abort"
# target: artifacts.pkr.json packer.json
run: |
export IMAGE="docker.pkg.github.com/cloudfire-llc/cloudfire-ce/cloudfire:${GITHUB_SHA::8}"
docker build -t $IMAGE .
docker push $IMAGE
echo `which packer`
echo 'Packer?'
# 3. Functional Test
docker-compose-up:
needs: build-app-image
functional-test:
needs: build-vm
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- uses: azure/docker-login@v1
with:
login-server: docker.pkg.github.com
username: $GITHUB_ACTOR
password: ${{ secrets.GITHUB_TOKEN }}
- name: Functional Test
run: |
echo "TEST_IMAGE=docker.pkg.github.com/cloudfire-llc/cloudfire-ce/cloudfire:${GITHUB_SHA::8}" > .env
docker-compose -f docker-compose.yml -f docker-compose.test.yml up -d
echo 'Tests completed!'

View File

@@ -1,70 +0,0 @@
FROM elixir:1.10.2-alpine AS builder
MAINTAINER docker@cloudfire.network
ENV MIX_ENV=prod
ARG PHOENIX_DIR=./apps/cf_phx
# These are used only for building and won't matter later on
# ENV DATABASE_URL=ecto://dummy:dummy@dummy/dummy
# ENV SECRET_KEY_BASE=dummy
# Install dependencies
RUN apk add --update build-base npm git
WORKDIR /app
# Install hex + rebar
RUN mix local.hex --force
RUN mix local.rebar --force
COPY mix.* ./
COPY $PHOENIX_DIR/mix.* $PHOENIX_DIR/
COPY apps/system_engine/mix.* ./apps/system_engine/
RUN mix deps.get
RUN mix deps.compile
COPY config config
# Build assets
COPY $PHOENIX_DIR/assets $PHOENIX_DIR/assets
COPY $PHOENIX_DIR/priv $PHOENIX_DIR/priv
RUN npm install --prefix $PHOENIX_DIR/assets
RUN npm run deploy --prefix $PHOENIX_DIR/assets
RUN mix phx.digest
# Build project
COPY $PHOENIX_DIR/lib $PHOENIX_DIR/lib
COPY apps/system_engine/lib ./apps/system_engine/lib
RUN mix compile
# Build releases
RUN mix release cf_phx
RUN mix release system_engine
COPY bin bin
# The built application is now contained in _build/
# --------------------------------------------------
FROM alpine:3.11 AS app
RUN apk add --update bash openssl
EXPOSE 4000
ENV PORT=4000 \
SHELL=/bin/bash
RUN mkdir /app
WORKDIR /app
COPY --from=builder /app/_build/prod/rel/cf_phx ./cf_phx
COPY --from=builder /app/_build/prod/rel/system_engine ./system_engine
COPY --from=builder /app/bin ./bin
RUN chown -R nobody: /app
USER nobody
ENV HOME=/app

View File

@@ -1,7 +0,0 @@
version: "3.3"
services:
cf-phx:
build: ./
system-engine:
build: ./

View File

@@ -1,6 +0,0 @@
version: "3.3"
services:
cf-phx:
image: ${TEST_IMAGE}
system-engine:
image: ${TEST_IMAGE}

View File

@@ -1,57 +0,0 @@
# The base docker-compose
version: "3.3"
services:
cf-phx:
depends_on:
- db
command: ["bin/start_cf_phx.sh"]
image: cloudfirellc/cloudfire:latest
environment:
DATABASE_URL: ecto://postgres:postgres@db/cloudfire
# !! WARNING !!
# Change this for production systems!
# !!!!!!!!!!!!!
SECRET_KEY_BASE: vw5YEoG6Pb7mCQEC41DjJXIB6v1/tOxO+3YLN+5k+PILkcFMN54g22KXZr6o65Bn
ERL_COOKIE: bSHTSulle4fn4ZgH3CgT6gEEtLiH9leOh1Ykeo4JEEyG31aeDZnDwEWCIhEKM0kF
ports:
- 4000:4000
networks:
- cloudfire
system-engine:
depends_on:
- db
command: ["system_engine/bin/system_engine", "start"]
image: cloudfirellc/cloudfire:latest
environment:
DATABASE_URL: ecto://postgres:postgres@db/cloudfire
# !! WARNING !!
# Change these for production systems!
# !!!!!!!!!!!!!
SECRET_KEY_BASE: vw5YEoG6Pb7mCQEC41DjJXIB6v1/tOxO+3YLN+5k+PILkcFMN54g22KXZr6o65Bn
ERL_COOKIE: bSHTSulle4fn4ZgH3CgT6gEEtLiH9leOh1Ykeo4JEEyG31aeDZnDwEWCIhEKM0kF
networks:
- cloudfire
db:
networks:
- cloudfire
image: postgres:12
volumes:
- pg-data:/var/lib/postgresql/data
environment:
# !! WARNING !!
# Change this for production systems!
# !!!!!!!!!!!!!
POSTGRES_PASSWORD: postgres
ports:
- 5432:5432
volumes:
pg-data:
networks:
cloudfire: