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

Docker multi arch fix #143

Merged
merged 5 commits into from
Nov 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/docker-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
timeout-minutes: 1
services:
ftpserver:
image: ftpserver/ftpserver
image: fclairamb/ftpserver
ports:
- 2121-2130:2121-2130

Expand Down
75 changes: 50 additions & 25 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,54 @@
name: Docker Image
name: Docker image v2

on:
push:
release:
types:
- created
push:
branches:
- "**"
tags:
- "v*.*.*"
pull_request:

jobs:
create-docker-image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Setup go
uses: actions/setup-go@v2
with:
go-version: 1.15

- name: Build
run: CGO_ENABLED=0 go build

- name: Publish to Registry
uses: elgohr/Publish-Docker-Github-Action@master
with:
name: ftpserver/ftpserver
username: ftpserver
password: ${{ secrets.DOCKER_PASSWORD }}
tag_semver: true
multi-registries:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Docker meta
id: docker_meta
uses: crazy-max/ghaction-docker-meta@v1
with:
images: fclairamb/ftpserver
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ github.repository_owner }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.CR_PAT }}
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/386,linux/arm/v6,linux/arm/v7,linux/arm64
push: true
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
17 changes: 15 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
# Should be started with:
# docker run -ti -p 2121-2130:2121-2130 ftpserver/ftpserver
# docker run -ti -p 2121-2130:2121-2130 fclairamb/ftpserver

# Preparing the build environment
FROM golang:1.15-alpine AS builder
ENV GOFLAGS="-mod=readonly"
RUN apk add --update --no-cache bash ca-certificates curl git
RUN mkdir -p /workspace
WORKDIR /workspace

# Building
COPY . .
RUN go build -v -o ftpserver

# Preparing the final image
FROM alpine:3.12.1
EXPOSE 2121-2130
COPY ftpserver /bin/ftpserver
COPY --from=builder /workspace/ftpserver /bin/ftpserver
ENTRYPOINT [ "/bin/ftpserver" ]