Skip to content

Commit

Permalink
docker setup
Browse files Browse the repository at this point in the history
  • Loading branch information
cma2819 committed Nov 18, 2024
1 parent bb3780d commit 2f21fdd
Show file tree
Hide file tree
Showing 3 changed files with 92 additions and 0 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: DockerBuild
on:
push:
branches: [main]

permissions:
id-token: write
contents: read
attestations: write
packages: write

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build:
runs-on: ubuntu-latest
steps:
-
name: Checkout repository
uses: actions/checkout@v4
-
name: Login to registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
-
name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
-
name: Build and push
id: push
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
target: app
-
name: Generate artifact attestation
uses: actions/attest-build-provenance@v1
with:
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: true
27 changes: 27 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
FROM node:18 as base

FROM base as build

COPY ./app /remix/app
COPY ./package.json /remix/package.json
COPY ./package-lock.json /remix/package-lock.json
COPY ./postcss.config.js /remix/postcss.config.js
COPY ./tailwind.config.ts /remix/tailwind.config.ts
COPY ./tsconfig.json /remix/tsconfig.json
COPY ./vite.config.ts /remix/vite.config.ts

WORKDIR /remix

RUN npm ci && npm run build

FROM base as app

COPY --from=build /remix/build /app/build
COPY --from=build /remix/node_modules /app/node_modules
COPY --from=build /remix/package.json /app/package.json
COPY ./public /app/public
COPY ./.env /app/.env

WORKDIR /app

CMD [ "npm", "start" ]
13 changes: 13 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version: '3'
services:
app:
build:
context: .
dockerfile: Dockerfile
target: app
ports:
- 13000:3000
environment:
- DISCORD_USERNAME=受付PC
- DISCORD_WEBHOOK=https://discord.com/api/webhooks/669136267790909480/JckNafw2-d_RPfhNAYkc5rIc1wqkcOhLSdP3sn9miWTFLX0vZ7EBPyRxTgJvTbkhE87X
- DISCORD_MENTION=<@&794200015416983582>

0 comments on commit 2f21fdd

Please sign in to comment.