Skip to content

Commit 10520a9

Browse files
committed
Add simple Dockerfile for local/development builds
1 parent ab90d5e commit 10520a9

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

.dockerignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
!cmd/
33
!go.mod
44
!go.sum
5-
!scripts/bashbrew-arch-to-goenv.sh
5+
!scripts/
66
!vendor/

Dockerfile

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
FROM tianon/docker-tianon
2+
3+
SHELL ["bash", "-Eeuo", "pipefail", "-xc"]
4+
5+
RUN apt-get update; \
6+
apt-get install -y --no-install-recommends \
7+
golang-go \
8+
; \
9+
rm -rf /var/lib/apt/lists/*
10+
11+
WORKDIR /usr/src/bashbrew
12+
COPY go.mod go.sum ./
13+
COPY cmd cmd
14+
COPY vendor vendor
15+
RUN export CGO_ENABLED=0; \
16+
go build -mod vendor -v -o /usr/local/bin/bashbrew ./cmd/bashbrew; \
17+
rm -r ~/.cache/go-build; \
18+
bashbrew --help > /dev/null
19+
20+
ENV BASHBREW_CACHE /bashbrew-cache
21+
# make sure our default cache dir exists and is writable by anyone (similar to /tmp)
22+
RUN mkdir -p "$BASHBREW_CACHE"; \
23+
chmod 1777 "$BASHBREW_CACHE"
24+
# (this allows us to decide at runtime the exact uid/gid we'd like to run as)
25+
26+
VOLUME $BASHBREW_CACHE
27+
28+
COPY scripts/bashbrew-entrypoint.sh /usr/local/bin/
29+
ENTRYPOINT ["bashbrew-entrypoint.sh"]

0 commit comments

Comments
 (0)