Skip to content

Commit eba901c

Browse files
committed
use docker build for golang binary
1 parent e65d0f8 commit eba901c

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

Dockerfile

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
FROM ubuntu:20.04
2+
3+
ARG package_args='--allow-downgrades --allow-remove-essential --allow-change-held-packages --no-install-recommends'
4+
RUN echo "debconf debconf/frontend select noninteractive" | debconf-set-selections && \
5+
export DEBIAN_FRONTEND=noninteractive && \
6+
apt-get -y $package_args update && \
7+
apt-get -y $package_args dist-upgrade && \
8+
apt-get -y $package_args install curl ca-certificates gnupg tzdata golang git
9+
10+
WORKDIR /go/src/github.com/swisscom/backman
11+
COPY . .
12+
RUN go build -o backman
13+
114
FROM ubuntu:20.04
215
LABEL maintainer="JamesClonk <[email protected]>"
316

@@ -29,10 +42,12 @@ RUN useradd -u 2000 -mU -s /bin/bash vcap && \
2942
chown vcap:vcap /home/vcap/app
3043

3144
WORKDIR /home/vcap/app
32-
COPY backman ./
45+
#COPY backman ./
3346
COPY public ./public/
3447
COPY static ./static/
48+
COPY --from=0 /go/src/github.com/swisscom/backman/backman ./backman
3549

50+
RUN chmod +x /home/vcap/app/backman
3651
RUN chown -R vcap:vcap /home/vcap/app
3752
USER vcap
3853

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ init:
5151

5252
.PHONY: docker-build
5353
## docker-build: builds docker image
54-
docker-build: clean build
54+
docker-build: clean
5555
docker build -t jamesclonk/${APP}:${COMMIT_SHA} $$PWD
5656

5757
.PHONY: docker-push

manifest.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ applications:
2323

2424
# ### push either as docker image
2525
docker:
26-
image: jamesclonk/backman:1.23.0 # choose version from https://hub.docker.com/r/jamesclonk/backman/tags, or 'latest'
26+
image: jamesclonk/backman:1.23.1 # choose version from https://hub.docker.com/r/jamesclonk/backman/tags, or 'latest'
2727
# ### or as buildpack/src
2828
# buildpacks:
2929
# - https://github.com/cloudfoundry/apt-buildpack

0 commit comments

Comments
 (0)