Skip to content

Commit ecd5d7d

Browse files
committed
Merge branch 'develop'
2 parents 08275ea + 53c2092 commit ecd5d7d

File tree

6 files changed

+68
-7
lines changed

6 files changed

+68
-7
lines changed

.env.example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
DOCKER_HUB_ACCESS_TOKEN="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
2+
DOCKER_HUB_USERNAME=daveperrett
13
GITHUB_TOKEN=ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
24
NEXT_PUBLIC_ANALYTICS_DOMAIN=string.test
35
NEXT_PUBLIC_ANALYTICS_ENABLED=false

.github/workflows/dockerhub.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
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 }}

.meta/301.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
## Publish releases to DockerHub
2+
3+
By [@recurser](https://github.com/recurser)
4+
5+
Created 2022-04-11 14:41

Dockerfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
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.
55
RUN apk add --no-cache libc6-compat
66
WORKDIR /app
77
COPY package.json yarn.lock ./
88
RUN 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
1212
WORKDIR /app
1313
COPY --from=deps /app/node_modules ./node_modules
1414
COPY . .
@@ -17,7 +17,7 @@ ENV NEXT_TELEMETRY_DISABLED 1
1717
RUN 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
2121
WORKDIR /app
2222

2323
ENV NODE_ENV production

README.md

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff 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
5252
yarn 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
5864
yarn docker-run
5965
```
6066

67+
or
68+
69+
```bash
70+
docker run -p 3000:3000 string-is
71+
```
72+
6173
Alternatively you can build and run it with `docker-compose`:
6274

6375
```bash
6476
docker-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

6990
The `src/lib` folder contains most of the conversion logic, and is pure TypeScript, with no React knowledge required.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
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",

0 commit comments

Comments
 (0)