From 7a154276e871aa841016a67a93ac77cb0b50bed5 Mon Sep 17 00:00:00 2001 From: Jamil Bou Kheir Date: Tue, 28 Apr 2020 21:55:50 -0700 Subject: [PATCH 1/2] Remove docker-compose in favor of packer --- .dockerignore | 10 ------ .github/workflows/main.yml | 38 ++++++++------------- Dockerfile | 70 -------------------------------------- docker-compose.dev.yml | 7 ---- docker-compose.test.yml | 6 ---- docker-compose.yml | 57 ------------------------------- 6 files changed, 15 insertions(+), 173 deletions(-) delete mode 100644 .dockerignore delete mode 100644 Dockerfile delete mode 100644 docker-compose.dev.yml delete mode 100644 docker-compose.test.yml delete mode 100644 docker-compose.yml diff --git a/.dockerignore b/.dockerignore deleted file mode 100644 index c38e4531c..000000000 --- a/.dockerignore +++ /dev/null @@ -1,10 +0,0 @@ -_build/ -deps/ -.git/ -.gitignore/ -Dockerfile -Makefile -README* -LICENSE -test/ -node_modules diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5ac8a5c56..a628ae707 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -8,7 +8,7 @@ on: jobs: # 1. Unit/Integration Test unit-integration-test: - runs-on: ubuntu-18.04 + runs-on: ubuntu-20.04 env: MIX_ENV: test POSTGRES_HOST: localhost @@ -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 + runs-on: ubuntu-20.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 - runs-on: ubuntu-18.04 + functional-test: + needs: build-vm + runs-on: ubuntu-20.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!' diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 23f768d9c..000000000 --- a/Dockerfile +++ /dev/null @@ -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 diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml deleted file mode 100644 index 34d14084e..000000000 --- a/docker-compose.dev.yml +++ /dev/null @@ -1,7 +0,0 @@ -version: "3.3" - -services: - cf-phx: - build: ./ - system-engine: - build: ./ diff --git a/docker-compose.test.yml b/docker-compose.test.yml deleted file mode 100644 index 43dce6313..000000000 --- a/docker-compose.test.yml +++ /dev/null @@ -1,6 +0,0 @@ -version: "3.3" -services: - cf-phx: - image: ${TEST_IMAGE} - system-engine: - image: ${TEST_IMAGE} diff --git a/docker-compose.yml b/docker-compose.yml deleted file mode 100644 index 9eeb87619..000000000 --- a/docker-compose.yml +++ /dev/null @@ -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: From 7b81e00f669c5420a53c983ba0c675121d7d4bb6 Mon Sep 17 00:00:00 2001 From: Jamil Bou Kheir Date: Tue, 28 Apr 2020 22:02:04 -0700 Subject: [PATCH 2/2] ubuntu 18.04 --- .github/workflows/main.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a628ae707..2e5988429 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -8,7 +8,7 @@ on: jobs: # 1. Unit/Integration Test unit-integration-test: - runs-on: ubuntu-20.04 + runs-on: ubuntu-18.04 env: MIX_ENV: test POSTGRES_HOST: localhost @@ -44,7 +44,7 @@ jobs: # 2. Build VM image build-vm: needs: unit-integration-test - runs-on: ubuntu-20.04 + runs-on: ubuntu-18.04 steps: - uses: actions/checkout@v2 - name: Build VM Image @@ -60,7 +60,7 @@ jobs: # 3. Functional Test functional-test: needs: build-vm - runs-on: ubuntu-20.04 + runs-on: ubuntu-18.04 steps: - uses: actions/checkout@v2 - name: Functional Test