diff --git a/.github/workflows/destroy-infra.yml b/.github/workflows/destroy-infra.yml new file mode 100644 index 0000000..0f0ea4c --- /dev/null +++ b/.github/workflows/destroy-infra.yml @@ -0,0 +1,39 @@ +name: destroy-infra + +on: [workflow_dispatch] + +jobs: + destroy: + name: Destroy infrastructure + runs-on: ubuntu-latest + defaults: + run: + working-directory: 'infrastructure' + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Tofu + uses: opentofu/setup-opentofu@v1 + + - name: Init + run: tofu init + env: + TF_TOKEN_app_terraform_io: ${{ secrets.TF_API_TOKEN }} + + - name: Destroy + run: tofu destroy -input=false -auto-approve + env: + TF_VAR_GITHUB_SERVER_URL: ${{ github.server_url }} + TF_VAR_GITHUB_REPOSITORY: ${{ github.repository }} + TF_VAR_do_token: ${{ secrets.DO_PAT }} + TF_VAR_pub_key: ${{ secrets.PUB_KEY }} + TF_VAR_DATABASE_URL: ${{ secrets.DATABASE_URL }} + TF_VAR_POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }} + TF_VAR_NEXTAUTH_SECRET: ${{ secrets.NEXTAUTH_SECRET }} + TF_VAR_NEXT_PUBLIC_TG_BOT_NAME: ${{ secrets.NEXT_PUBLIC_TG_BOT_NAME }} + TF_VAR_TG_BOT_TOKEN: ${{ secrets.TG_BOT_TOKEN }} + TF_VAR_FORUM_ROOT_NAME: ${{ secrets.FORUM_ROOT_NAME }} + TF_VAR_TG_ACTIVE_GROUP_IDS: ${{ secrets.TG_ACTIVE_GROUP_IDS }} + TF_VAR_TG_ADMIN_GROUP_IDS: ${{ secrets.TG_ADMIN_GROUP_IDS }} + TF_TOKEN_app_terraform_io: ${{ secrets.TF_API_TOKEN }} \ No newline at end of file diff --git a/docker/Dockerfile.dbsync b/docker/Dockerfile.dbsync index 6d7751d..50bb531 100644 --- a/docker/Dockerfile.dbsync +++ b/docker/Dockerfile.dbsync @@ -1,4 +1,4 @@ -FROM --platform=linux/amd64 node:16-alpine3.16 +FROM --platform=linux/amd64 node:lts-alpine RUN apk add --no-cache libc6-compat openssl1.1-compat --repository=https://dl-cdn.alpinelinux.org/alpine/edge/testing WORKDIR /app RUN yarn global add pnpm typescript ts-node diff --git a/docker/Dockerfile.dev b/docker/Dockerfile.dev index f77e6e9..d33a77d 100644 --- a/docker/Dockerfile.dev +++ b/docker/Dockerfile.dev @@ -1,6 +1,6 @@ ##### DEVELOPMENT DOCKER IMAGE ##### DEPENDENCIES -FROM --platform=linux/amd64 node:16-alpine3.16 +FROM --platform=linux/amd64 node:lts-alpine RUN apk add --no-cache libc6-compat openssl1.1-compat --repository=https://dl-cdn.alpinelinux.org/alpine/edge/testing WORKDIR /app RUN yarn global add pnpm diff --git a/docker/Dockerfile.prod b/docker/Dockerfile.prod index 4ccd7fb..6441dc6 100644 --- a/docker/Dockerfile.prod +++ b/docker/Dockerfile.prod @@ -1,6 +1,6 @@ ##### DEPENDENCIES -FROM --platform=linux/amd64 node:16-alpine3.16 as deps +FROM --platform=linux/amd64 node:lts-alpine as deps RUN apk add --no-cache libc6-compat openssl1.1-compat-libs-static --repository=https://dl-cdn.alpinelinux.org/alpine/edge/testing WORKDIR /app @@ -22,7 +22,7 @@ RUN \ ##### BUILDER -FROM --platform=linux/amd64 node:16-alpine3.16 AS builder +FROM --platform=linux/amd64 node:lts-alpine AS builder RUN apk add --no-cache libc6-compat openssl1.1-compat-libs-static --repository=https://dl-cdn.alpinelinux.org/alpine/edge/testing RUN yarn global add pnpm ARG DATABASE_URL @@ -48,7 +48,7 @@ RUN --mount=type=secret,id=NEXT_PUBLIC_TG_BOT_NAME \ ##### RUNNER -FROM --platform=linux/amd64 node:16-alpine3.16 AS runner +FROM --platform=linux/amd64 node:lts-alpine AS runner RUN apk add --no-cache libc6-compat openssl1.1-compat-libs-static --repository=https://dl-cdn.alpinelinux.org/alpine/edge/testing RUN yarn global add pnpm WORKDIR /app diff --git a/docker/docker-compose.dev.yml b/docker/docker-compose.dev.yml index d7cc116..dec8aff 100644 --- a/docker/docker-compose.dev.yml +++ b/docker/docker-compose.dev.yml @@ -1,4 +1,3 @@ -version: "3.9" name: hytky-dev services: dev: @@ -18,7 +17,7 @@ services: condition: service_healthy restart: always postgres: - image: "postgres:15.1-alpine" + image: "postgres:alpine" environment: - POSTGRES_USER=postgres - POSTGRES_DB=postgres diff --git a/docker/docker-compose.prod.from-registry.yml b/docker/docker-compose.prod.from-registry.yml index 3eef355..5dc4d98 100644 --- a/docker/docker-compose.prod.from-registry.yml +++ b/docker/docker-compose.prod.from-registry.yml @@ -1,4 +1,3 @@ -version: "3.9" name: hytky-prod services: nginx: @@ -26,7 +25,7 @@ services: restart: always postgres: - image: "postgres:15.1-alpine" + image: "postgres:alpine" environment: - POSTGRES_USER=postgres - POSTGRES_DB=postgres diff --git a/docker/docker-compose.prod.tls-registry.yml b/docker/docker-compose.prod.tls-registry.yml index 40ff80a..494257f 100644 --- a/docker/docker-compose.prod.tls-registry.yml +++ b/docker/docker-compose.prod.tls-registry.yml @@ -1,4 +1,3 @@ -version: "3.9" name: hytky-prod services: nginx: @@ -30,7 +29,7 @@ services: restart: unless-stopped postgres: - image: "postgres:15.1-alpine" + image: "postgres:alpine" environment: - POSTGRES_USER=postgres - POSTGRES_DB=postgres diff --git a/docker/docker-compose.prod.yml b/docker/docker-compose.prod.yml index 6e96fb9..3951194 100644 --- a/docker/docker-compose.prod.yml +++ b/docker/docker-compose.prod.yml @@ -1,4 +1,3 @@ -version: "3.9" name: hytky-prod services: nginx: @@ -29,7 +28,7 @@ services: restart: always postgres: - image: "postgres:15.1-alpine" + image: "postgres:alpine" environment: - POSTGRES_USER=postgres - POSTGRES_DB=postgres