Skip to content

Commit

Permalink
add Docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
omegion committed Mar 4, 2021
1 parent 8618981 commit 19e5af3
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 3 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
name: Build DB Backup
name: Build

on:
push:
tags:
- 'v*'
jobs:
push_to_registry:
name: Push Docker image to Docker Hub
name: Push Docker image to Docker Hub and GitHub
runs-on: ubuntu-latest
steps:
- name: Check out the repo
Expand Down
30 changes: 30 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
ARG GO_VERSION=1.15-alpine3.12
ARG FROM_IMAGE=alpine:3.11

FROM golang:${GO_VERSION} AS builder

LABEL org.opencontainers.image.source="https://github.com/omegion/bw-ssh"

RUN apk update && \
apk add ca-certificates gettext git make && \
rm -rf /tmp/* && \
rm -rf /var/cache/apk/* && \
rm -rf /var/tmp/*

COPY ./ /app

WORKDIR /app

RUN make build-for-container

FROM ${FROM_IMAGE}

RUN apk update && \
apk add ca-certificates gettext jq curl openssl git postgresql && \
rm -rf /tmp/* && \
rm -rf /var/cache/apk/* && \
rm -rf /var/tmp/*

COPY --from=builder /app/dist/bw-ssh-linux /bin/bw-ssh

ENTRYPOINT ["bw-ssh"]
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ build:
CGO_ENABLED=0 go build $(LDFLAGS) -installsuffix cgo -o dist/bw-ssh main.go

build-for-container:
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build $(LDFLAGS) -a -installsuffix cgo -o dist/bw-ssh-linux cmd/bw-ssh/main.go
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build $(LDFLAGS) -a -installsuffix cgo -o dist/bw-ssh-linux main.go

.PHONY: lint
lint:
Expand Down

0 comments on commit 19e5af3

Please sign in to comment.