Skip to content

Commit

Permalink
Merge pull request #252 from thearyadev/docker
Browse files Browse the repository at this point in the history
Docker
  • Loading branch information
thearyadev authored Dec 24, 2024
2 parents 86a5d49 + 663cb4c commit faed8da
Show file tree
Hide file tree
Showing 5 changed files with 84 additions and 2 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: docker build

on:
pull_request:

jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build
uses: docker/build-push-action@v5
with:
tags: thearyadev/t500-aggregator-test-build:latest
32 changes: 32 additions & 0 deletions .github/workflows/push.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: docker build and push

on:
push:
branches:
- main
jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Extract and manipulate tag name
id: extract_tag
run: |
CLEAN_TAG_NAME=${date +%Y%m%d}
echo "TAG_NAME=${TAG_NAME}" >> $GITHUB_ENV
echo "CLEAN_TAG_NAME=${CLEAN_TAG_NAME}" >> $GITHUB_ENV
- name: Build and push
uses: docker/build-push-action@v5
with:
push: true
tags: thearyadev0/top500-aggregator:${{ env.CLEAN_TAG_NAME }}
33 changes: 33 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
FROM node:22.12 as builder
WORKDIR /build
COPY frontend/package.json .
COPY frontend/package-lock.json .
RUN npm install
COPY data ./data
COPY frontend ./frontend
RUN cd frontend && npm run build

FROM nginx:stable-alpine
COPY --from=builder /build/frontend/out /usr/share/nginx/html

# Create custom Nginx configuration
RUN echo ' \
server { \
listen 80; \
server_name _; \
root /usr/share/nginx/html; \
index index.html; \
\
location / { \
try_files $uri $uri/ $uri.html =404; \
} \
\
location ~* \.(jpg|jpeg|png|gif|ico|css|js)$ { \
expires max; \
access_log off; \
} \
} \
' > /etc/nginx/conf.d/default.conf

EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
2 changes: 1 addition & 1 deletion frontend/next-env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
// see https://nextjs.org/docs/app/building-your-application/configuring/typescript for more information.
2 changes: 1 addition & 1 deletion frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit faed8da

Please sign in to comment.