Skip to content

Commit

Permalink
ci: Remove preview and refactor build files (#314)
Browse files Browse the repository at this point in the history
* ci: Remove CircleCI integration

* ci: Refactor docker configuration

* ci: Add GHA to run tests

* ci: Use PostgreSQL docker image directly
  • Loading branch information
kesara authored Jun 27, 2023
1 parent 85ee10c commit 732293e
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 126 deletions.
92 changes: 0 additions & 92 deletions .circleci/config.yml

This file was deleted.

8 changes: 0 additions & 8 deletions .circleci/ecs-preview.toml

This file was deleted.

31 changes: 31 additions & 0 deletions .github/workflows/ci-run-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Run tests
on:
push:
branches:
- main
pull_request:
branches:
- '*'

jobs:
test:
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v3

- name: Docker build app-test
uses: docker/build-push-action@v3
with:
context: .
file: docker/Dockerfile
target: app-test
push: false
tags: app-test:latest

- name: Start database
run: docker run --name=database -e POSTGRES_DB=app -e POSTGRES_PASSWORD=password -d postgres:14.6

- name: Run tests
run: docker run -i --rm --name=app-test -u root --link=database -e DATABASE_URL="postgres://postgres:password@database/app" -e APP_SECRET_KEY=xxxx -e ENVIRONMENT=test app-test
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ services:

database:
restart: on-failure
image: postgres:14.6-alpine
image: postgres:14.6
volumes:
- "./docker/database:/docker-entrypoint-initdb.d/"
environment:
Expand Down
22 changes: 1 addition & 21 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,6 @@ RUN yarn dist

CMD ["yarn", "start"]

# ---------------------------------------------------------------------
# SSM-PARENT
# ---------------------------------------------------------------------
# Needed for hosting on AWS
FROM springload/ssm-parent:1.4.1 as ssm-parent

# ---------------------------------------------------------------------
# BASE
# ---------------------------------------------------------------------
Expand Down Expand Up @@ -77,20 +71,6 @@ ENV PROJECT wagtail_website

USER www

# ---------------------------------------------------------------------
# AWS - APP
# ---------------------------------------------------------------------
# AWS hosting stages
FROM base as aws-app

# ssm-parent is needed for dynamic env-variable configuration on AWS.
# It just reads encrypted secrets from AWS SSM Parameter Store and exposes them
# as the environment variables to the process inside of the container
COPY --from=ssm-parent /usr/bin/ssm-parent /usr/bin/ssm-parent

ENTRYPOINT ["/usr/bin/ssm-parent", "run", "-e", "-p", "/$PROJECT/common/", "-p", "/$PROJECT/$ENVIRONMENT/", "-n", "/$PROJECT/$ENVIRONMENT/ssm", "-r", "--"]
CMD ["/usr/local/bin/gunicorn", "--config", "/app/docker/gunicorn.py", "ietf.wsgi" ]

# ---------------------------------------------------------------------
# APP
# ---------------------------------------------------------------------
Expand Down Expand Up @@ -149,4 +129,4 @@ COPY docker/supervisord-sandbox.conf /app/supervisord.conf

RUN mkdir -p /app/media

CMD ["/usr/bin/supervisord", "-c", "/app/supervisord.conf"]
CMD ["/usr/bin/supervisord", "-c", "/app/supervisord.conf"]
6 changes: 3 additions & 3 deletions docker/db.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# =====================
# --- Builder Stage ---
# =====================
FROM postgres:14.5 AS builder
FROM postgres:14.6 AS builder

ENV POSTGRES_PASSWORD=password
ENV POSTGRES_USER=postgres
Expand All @@ -18,12 +18,12 @@ RUN ["/usr/local/bin/docker-entrypoint.sh", "postgres"]
# ===================
# --- Final Image ---
# ===================
FROM postgres:14.5
FROM postgres:14.6
LABEL maintainer="IETF Tools Team <tools-discuss@ietf.org>"

COPY --from=builder /data $PGDATA

ENV POSTGRES_PASSWORD=password
ENV POSTGRES_USER=postgres
ENV POSTGRES_DB=app
ENV POSTGRES_HOST_AUTH_METHOD=trust
ENV POSTGRES_HOST_AUTH_METHOD=trust
1 change: 0 additions & 1 deletion infra
Submodule infra deleted from 08476d

0 comments on commit 732293e

Please sign in to comment.