File tree Expand file tree Collapse file tree 5 files changed +63
-7
lines changed Expand file tree Collapse file tree 5 files changed +63
-7
lines changed Original file line number Diff line number Diff line change 1+ DOCKER_HUB_ACCESS_TOKEN = " xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
2+ DOCKER_HUB_USERNAME = daveperrett
13GITHUB_TOKEN = ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
24NEXT_PUBLIC_ANALYTICS_DOMAIN = string.test
35NEXT_PUBLIC_ANALYTICS_ENABLED = false
Original file line number Diff line number Diff line change 1+ name : Publish to Docker Hub
2+
3+ on :
4+ push :
5+ tags :
6+ - " v*.*.*"
7+
8+ jobs :
9+ publish_to_dockerhub :
10+ runs-on : ubuntu-latest
11+ steps :
12+ - name : Checkout
13+ uses : actions/checkout@v2
14+ - name : Login to Docker Hub
15+ uses : docker/login-action@v1
16+ with :
17+ username : ${{ secrets.DOCKER_HUB_USERNAME }}
18+ password : ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
19+ - name : Set up Docker Buildx
20+ uses : docker/setup-buildx-action@v1
21+ - name : Get the version
22+ run : echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
23+ - name : Build and push
24+ uses : docker/build-push-action@v2
25+ with :
26+ builder : ${{ steps.buildx.outputs.name }}
27+ cache-from : type=registry,ref=${{ secrets.DOCKER_HUB_USERNAME }}/string-is:buildcache
28+ cache-to : type=registry,ref=${{ secrets.DOCKER_HUB_USERNAME }}/string-is:buildcache,mode=max
29+ context : ./
30+ file : ./Dockerfile
31+ platforms : linux/arm64, linux/amd64
32+ push : true
33+ tags : ${{ secrets.DOCKER_HUB_USERNAME }}/string-is:latest, ${{ secrets.DOCKER_HUB_USERNAME }}/string-is:${{ env.RELEASE_VERSION }}
Original file line number Diff line number Diff line change 1-
21# Install dependencies only when needed
3- FROM node:17-alpine AS deps
2+ FROM --platform=$BUILDPLATFORM node:17-alpine AS deps
3+
44# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
55RUN apk add --no-cache libc6-compat
66WORKDIR /app
77COPY package.json yarn.lock ./
88RUN yarn install --frozen-lockfile
99
1010# Rebuild the source code only when needed
11- FROM node:17-alpine AS builder
11+ FROM --platform=$BUILDPLATFORM node:17-alpine AS builder
1212WORKDIR /app
1313COPY --from=deps /app/node_modules ./node_modules
1414COPY . .
@@ -17,7 +17,7 @@ ENV NEXT_TELEMETRY_DISABLED 1
1717RUN yarn build
1818
1919# Production image, copy all the files and run next
20- FROM node:17-alpine AS runner
20+ FROM --platform=$BUILDPLATFORM node:17-alpine AS runner
2121WORKDIR /app
2222
2323ENV NODE_ENV production
Original file line number Diff line number Diff line change @@ -46,24 +46,45 @@ yarn all
4646
4747## Running with Docker
4848
49- Build the docker image (shortcut for ` docker build -t string-is . ` ) :
49+ Build the docker image:
5050
5151``` bash
5252yarn docker-build
5353```
5454
55- ... and then run it (shortcut for ` docker run -p 3000:3000 string-is ` ):
55+ or
56+
57+ ``` bash
58+ docker build -t string-is .
59+ ```
60+
61+ ... and then run it:
5662
5763``` bash
5864yarn docker-run
5965```
6066
67+ or
68+
69+ ``` bash
70+ docker run -p 3000:3000 string-is
71+ ```
72+
6173Alternatively you can build and run it with ` docker-compose ` :
6274
6375``` bash
6476docker-compose up
6577```
6678
79+ ... or even run it directly from [ Docker Hub] ( https://hub.docker.com/repository/docker/daveperrett/string-is/tags?page=1&ordering=last_updated ) :
80+
81+ ``` bash
82+ docker run -p 4000:3000 daveperrett/string-is:latest
83+ ````
84+
85+ Currently ` linux/arm64` and ` linux/amd64` platforms are supported.
86+
87+
6788# # Adding a new converter
6889
6990The ` src/lib` folder contains most of the conversion logic, and is pure TypeScript, with no React knowledge required.
Original file line number Diff line number Diff line change 66 "all" : " yarn eslint pages src --fix && yarn prettier && yarn jest && yarn build" ,
77 "build" : " next build" ,
88 "dev" : " next dev" ,
9- "docker-build" : " docker build -t string-is ." ,
9+ "docker-build" : " docker build --platform linux/arm64 - t string-is ." ,
1010 "docker-run" : " docker run -p 3000:3000 string-is" ,
1111 "eslint" : " eslint --ext=js,ts,tsx" ,
1212 "format" : " yarn eslint src pages --fix && yarn prettier" ,
You can’t perform that action at this time.
0 commit comments