-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
240 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
version: "3.3" | ||
services: | ||
blog: | ||
image: ghcr.io/memebattle/blog:latest | ||
networks: | ||
- traefik-public | ||
deploy: | ||
labels: | ||
- "traefik.enable=true" | ||
- "traefik.http.routers.blog.rule=Host(`blog.mems.fun`)" | ||
- "traefik.http.routers.blog.entrypoints=web" | ||
- "traefik.http.services.blog.loadbalancer.server.port=3000" | ||
- "traefik.http.services.blog.loadbalancer.passhostheader=true" | ||
replicas: 1 | ||
update_config: | ||
parallelism: 2 | ||
delay: 10s | ||
restart_policy: | ||
condition: on-failure | ||
delay: 10s | ||
max_attempts: 3 | ||
|
||
networks: | ||
traefik-public: | ||
external: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
FROM node:18.14-bullseye-slim AS dependencies | ||
|
||
WORKDIR /memebattle | ||
|
||
COPY .yarn/ /memebattle/.yarn | ||
COPY package.json yarn.lock .yarnrc.yml /memebattle/ | ||
COPY apps/blog/package.json /memebattle/apps/blog/ | ||
|
||
RUN yarn install | ||
|
||
FROM dependencies AS build | ||
|
||
ENV NODE_ENV=production | ||
|
||
COPY . /memebattle | ||
WORKDIR /memebattle/apps/blog | ||
|
||
RUN node ../../node_modules/.bin/next build | ||
|
||
FROM node:18.14-bullseye-slim AS runtime | ||
ENV NODE_ENV=production | ||
|
||
RUN mkdir -p /memebattle | ||
WORKDIR /memebattle | ||
USER node | ||
|
||
COPY --chown=node:node --from=build /memebattle/apps/blog/public ./apps/blog/public | ||
COPY --chown=node:node --from=build /memebattle/apps/blog/.next/standalone ./ | ||
COPY --chown=node:node --from=build /memebattle/apps/blog/.next/static ./apps/blog/.next/static | ||
|
||
ENTRYPOINT [ "node", "apps/blog/server.js" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
* | ||
!apps/blog | ||
|
||
!.yarn/patches | ||
!.yarn/plugins | ||
!.yarn/releases | ||
!.yarn/sdks | ||
!.yarn/versions | ||
|
||
!yarn.lock | ||
!.yarnrc.yml | ||
!package.json | ||
!tsconfig.json | ||
!typings | ||
!.env* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
name: 'Blog build, push and deploy' | ||
|
||
on: | ||
push: | ||
branches: [ master, feature/198-blog-deploy-workflow ] | ||
paths: | ||
- 'apps/blog/**' | ||
- '.deploy/blog.deploy.yml' | ||
- '.docker/Blog_Dockerfile*' | ||
- '.github/workflows/blog-deploy.yml' | ||
|
||
env: | ||
AWS_REGION: 'eu-north-1' | ||
|
||
jobs: | ||
|
||
build-blog-image: | ||
runs-on: ubuntu-20.04 | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Docker Setup QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
with: | ||
platforms: 'arm64' | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
with: | ||
driver-opts: env.BUILDKIT_STEP_LOG_MAX_SIZE=10485760 | ||
|
||
- name: Docker login | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build and push | ||
uses: docker/build-push-action@v3 | ||
with: | ||
platforms: linux/arm64 | ||
push: true | ||
tags: | | ||
ghcr.io/memebattle/blog:${{ github.sha }} | ||
ghcr.io/memebattle/blog:latest | ||
context: '.' | ||
file: '.docker/Blog_Dockerfile' | ||
cache-from: type=gha,scope=$GITHUB_REF_NAME-blog | ||
cache-to: type=gha,mode=max,scope=$GITHUB_REF_NAME-blog | ||
|
||
deploy: | ||
needs: [build-blog-image] | ||
|
||
runs-on: ubuntu-20.04 | ||
|
||
environment: | ||
name: Blog-production | ||
url: https://blog.mems.fun | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
name: Checkout | ||
|
||
- uses: ./.github/actions/deploy-to-swarm | ||
name: Deploy to swarm lambda | ||
with: | ||
path-to-stack: '.deploy/gamehub.deploy.yml' | ||
name: 'BLOG' | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
docker_login: ${{ secrets.GHCR_USER }} | ||
docker_password: ${{ secrets.GHCR_PULL_TOKEN }} | ||
docker_registry: 'ghcr.io' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.