Skip to content

Commit

Permalink
docker action test
Browse files Browse the repository at this point in the history
  • Loading branch information
leomotors committed Sep 7, 2024
1 parent e1d7955 commit dd84a87
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 16 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Publish Release

on:
push:
tags:
- '*.*'

jobs:
release:
name: Publish Release
runs-on: ubuntu-latest

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

- name: Publish Release
uses: leomotors/auto-publish-release@main
with:
githubToken: ${{ secrets.GITHUB_TOKEN }}
title: 'programming.in.th'
tag: ${{ github.ref_name }}

image:
name: Docker Image
runs-on: ubuntu-latest

permissions:
id-token: write
packages: write

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- uses: winterjung/split@v2
id: version
with:
msg: ${{ github.ref_name }}
separator: '.'

- name: Build Docker image
uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile
push: true
tags: ghcr.io/programming-in-th/programming.in.th:${{ github.ref_name }},ghcr.io/programming-in-th/programming.in.th:v${{ steps.version.outputs._0 }},ghcr.io/programming-in-th/programming.in.th:latest
platforms: linux/amd64,linux/arm64
cache-from: type=gha
cache-to: type=gha,mode=max
32 changes: 16 additions & 16 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@

FROM node:20-alpine AS base

ENV DOCKER_BUILD=1
ENV NEXT_PUBLIC_REALTIME_URL=https://rtss.crackncode.org
ENV NEXT_PUBLIC_AWS_URL=https://prginth01.sgp1.cdn.digitaloceanspaces.com
ENV DOCKER_BUILD 1
ENV NEXT_PUBLIC_REALTIME_URL https://rtss.crackncode.org
ENV NEXT_PUBLIC_AWS_URL https://prginth01.sgp1.cdn.digitaloceanspaces.com

ENV GITHUB_ID=mockvalue
ENV GITHUB_SECRET=mockvalue
ENV GOOGLE_CLIENT_ID=mockvalue
ENV GOOGLE_CLIENT_SECRET=mockvalue
ENV GITHUB_ID mockvalue
ENV GITHUB_SECRET mockvalue
ENV GOOGLE_CLIENT_ID mockvalue
ENV GOOGLE_CLIENT_SECRET mockvalue

ENV BUCKET_NAME=mockvalue
ENV BUCKET_KEY_ID=mockvalue
ENV BUCKET_KEY_SECRET=mockvalue
ENV BUCKET_ENDPOINT=mockvalue
ENV BUCKET_REGION=mockvalue
ENV BUCKET_NAME mockvalue
ENV BUCKET_KEY_ID mockvalue
ENV BUCKET_KEY_SECRET mockvalue
ENV BUCKET_ENDPOINT mockvalue
ENV BUCKET_REGION mockvalue

# ? -------------------------
# ? Builder: Build production Next.js application to .next
Expand Down Expand Up @@ -53,10 +53,10 @@ FROM base AS runner

WORKDIR /app

LABEL name="programming.in.th"
LABEL name "programming.in.th"

USER node
ENV NODE_ENV=production
ENV NODE_ENV production

COPY package.json ./

Expand All @@ -66,8 +66,8 @@ COPY --chown=node:node --from=builder /app/.next/standalone ./
COPY --chown=node:node --from=builder /app/.next/static ./.next/static
COPY --chown=node:node --from=builder /app/public ./public

ENV PORT=3000
ENV HOST=0.0.0.0
ENV PORT 3000
ENV HOST 0.0.0.0

EXPOSE 3000
CMD ["node", "server.js"]

0 comments on commit dd84a87

Please sign in to comment.