Skip to content

Commit eb083ed

Browse files
committed
Two stage Dockerfile for atsigncompany/filebin2
1 parent dd9f180 commit eb083ed

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

.github/workflows/docker-image.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
id: docker_build
2323
uses: docker/build-push-action@v2.5.0
2424
with:
25-
file: ./Dockerfile
25+
file: ./Dockerfile.prod
2626
push: true
2727
tags: |
2828
atsigncompany/filebin2:automated

Dockerfile.prod

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
FROM golang:buster AS build
2+
RUN export DEBIAN_FRONTEND=noninteractive && \
3+
apt-get install -y make gcc libc-dev git
4+
WORKDIR /app
5+
RUN go get -u github.com/jstemmer/go-junit-report
6+
RUN go get -u github.com/GeertJohan/go.rice/rice
7+
COPY . .
8+
RUN go build -tags netgo -ldflags '-extldflags "-static"'
9+
10+
FROM debian:stable-slim
11+
ENV HOMEDIR=/home/filebin2
12+
ENV USER_ID=1024
13+
ENV GROUP_ID=1024
14+
RUN apt-get update && \
15+
apt-get upgrade -y && \
16+
apt-get install ca-certificates -y && \
17+
update-ca-certificates && \
18+
mkdir -p $HOMEDIR && \
19+
mkdir -p /var/log/filebin && \
20+
addgroup --gid $GROUP_ID filebin2 && \
21+
useradd --system --uid $USER_ID --gid $GROUP_ID --shell /bin/bash \
22+
--home $HOMEDIR filebin2 && \
23+
chown -R filebin2:filebin2 $HOMEDIR && \
24+
chown -R filebin2:filebin2 /var/log/filebin
25+
COPY --from=build --chown=filebin2:filebin2 /app/filebin2 \
26+
/usr/local/bin/filebin2
27+
WORKDIR $HOMEDIR
28+
USER filebin2
29+
ENTRYPOINT ["/usr/local/bin/filebin2"]

0 commit comments

Comments
 (0)