Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Remove preview and refactor build files #314

Merged
merged 4 commits into from
Jun 27, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.

40 changes: 40 additions & 0 deletions .github/workflows/ci-run-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
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: Docker build db-local
uses: docker/build-push-action@v3
with:
context: .
file: docker/db.Dockerfile
target: db-local
push: false
tags: db-local:latest

- name: Start database
run: docker run --name=database -e POSTGRES_DB=app -e POSTGRES_PASSWORD=password -d db-local:latest

- 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
5 changes: 4 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ services:

database:
restart: on-failure
image: postgres:14.6-alpine
build:
context: .
dockerfile: docker/db.Dockerfile
target: db-local
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"]
12 changes: 9 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,18 @@ 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

# ================================
# --- Final Image with out data---
# ================================
FROM postgres:14.6 AS db-local
LABEL maintainer="IETF Tools Team <tools-discuss@ietf.org>"
NGPixel marked this conversation as resolved.
Show resolved Hide resolved
1 change: 0 additions & 1 deletion infra
Submodule infra deleted from 08476d