update dockerfile: add multi-arch and multi-stage
This commit is contained in:
parent
cab39eabb6
commit
d9cb8486b1
|
|
@ -7,15 +7,26 @@ jobs:
|
||||||
name: Push Docker image to Docker Hub
|
name: Push Docker image to Docker Hub
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Check out the repo
|
-
|
||||||
|
name: Check out the repo
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
- name: Log in to Docker Hub
|
-
|
||||||
|
name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v1
|
||||||
|
-
|
||||||
|
name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v1
|
||||||
|
-
|
||||||
|
name: Login to DockerHub
|
||||||
uses: docker/login-action@v1
|
uses: docker/login-action@v1
|
||||||
with:
|
with:
|
||||||
username: ${{ secrets.DOCKER_USERNAME }}
|
username: ${{ secrets.DOCKER_USERNAME }}
|
||||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
- name: Push to Docker Hub
|
-
|
||||||
|
name: Build and push
|
||||||
uses: docker/build-push-action@v2
|
uses: docker/build-push-action@v2
|
||||||
with:
|
with:
|
||||||
|
context: .
|
||||||
|
platforms: linux/amd64,linux/arm64
|
||||||
push: true
|
push: true
|
||||||
tags: xdbin/beancount-gs:latest
|
tags: xdbin/beancount-gs:latest
|
||||||
17
dockerfile
17
dockerfile
|
|
@ -1,18 +1,23 @@
|
||||||
# syntax=docker/dockerfile:1
|
# syntax=docker/dockerfile:1
|
||||||
FROM golang:1.17.3
|
FROM golang:1.17.3 AS builder
|
||||||
|
|
||||||
ENV GO111MODULE=on \
|
ENV GO111MODULE=on \
|
||||||
GOPROXY=https://goproxy.cn,direct \
|
GOPROXY=https://goproxy.cn,direct \
|
||||||
GIN_MODE=release \
|
GIN_MODE=release \
|
||||||
PORT=80
|
PORT=80
|
||||||
|
|
||||||
# install beancount
|
WORKDIR /builder
|
||||||
RUN apt-get update || : && apt-get install python3.5 python3-pip -y
|
|
||||||
RUN pip3 install beancount -i https://pypi.tuna.tsinghua.edu.cn/simple
|
|
||||||
|
|
||||||
WORKDIR /app
|
|
||||||
COPY . .
|
COPY . .
|
||||||
COPY public/icons ./public/default_icons
|
COPY public/icons ./public/default_icons
|
||||||
RUN go build .
|
RUN go build .
|
||||||
|
|
||||||
|
FROM python:latest
|
||||||
|
RUN pip3 install beancount -i https://pypi.tuna.tsinghua.edu.cn/simple
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
COPY --from=builder ./builder/public ./public
|
||||||
|
COPY --from=builder ./builder/config ./config
|
||||||
|
COPY --from=builder ./builder/template ./template
|
||||||
|
COPY --from=builder ./builder/beancount-gs* ./
|
||||||
|
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
Loading…
Reference in New Issue