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

Add docker container and compose file #37

Closed
wants to merge 13 commits into from
35 changes: 35 additions & 0 deletions .github/workflows/build-and-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Docker Image CI

on:
release:
types: [published]
pull_request:
types: [opened, synchronize, reopened]

jobs:
build-website:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Log in to GitHub container registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.DOCKER_PUSH }}

- name: Lowercase the repo name
run: echo "REPO=${GITHUB_REPOSITORY,,}" >>${GITHUB_ENV}

- name: Build and push container hashed image to registry
uses: docker/build-push-action@v4
with:
platforms: amd64,arm64
push: true
# Hashed and latest tags
tags: ghcr.io/${{ env.REPO }}:latest
file: ./Dockerfile
34 changes: 34 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
FROM node:lts as dependencies

WORKDIR /app
COPY package.json ./
RUN npm install

FROM node:lts as builder
WORKDIR /app
ENV NODE_ENV production
ENV TZ=Asia/Tokyo
COPY . .
COPY --from=dependencies /app/node_modules ./node_modules

RUN npm run build

FROM node:lts as runner

WORKDIR /app
ENV NODE_ENV production
ENV BASE_URL=http://localhost:8887
ENV NEXT_TELEMETRY_DISABLED 1
ENV TZ=Asia/Tokyo

COPY --from=builder /app/next.config.js ./
COPY --from=builder /app/*.ts ./
COPY --from=builder /app/public ./public
COPY --from=builder /app/.next ./.next
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/package.json ./package.json
COPY --from=builder /app/i18n ./i18n

EXPOSE 3000

CMD ["npm", "start"]
14 changes: 14 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: floorp

services:
web:
image: 'ghcr.io/joshika39/web:latest'
ports:
- "1005:3000"
environment:
REVIEWED_TRANSLATIONS: ja,en
NOT_STARTED_TRANSLATIONS: hu,ru
IN_REVIEW_TRANSLATIONS: none
DEFAULT_LOCALE: en
LOCALES: ja,hu,ru,en
ENV: development
Loading