-
-
Notifications
You must be signed in to change notification settings - Fork 14
/
Dockerfile-goutils
34 lines (24 loc) · 1.03 KB
/
Dockerfile-goutils
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
FROM golang:latest AS base
RUN apt-get update && apt-get install -y curl
# protobuf executables:
WORKDIR /tmp
# Install buf
RUN go install github.com/bufbuild/buf/cmd/buf@latest
# Detect arch for migrate
ENV ARCH="$(uname -m | sed 's/aarch64/aarch_64/g')"
RUN echo "Detected arch ${ARCH}"
# migrate:
ENV MIGRATE_VERSION v4.17.1
ENV MIGRATE_ARCH="$(case ${ARCH} in \"aarch_64\") echo \"arm64\" ;; \"x86_64\") echo \"amd64\";; *) echo \"invalid architecture\" ;; esac;)"
RUN echo "Fetching from URL: https://github.com/golang-migrate/migrate/releases/download/${MIGRATE_VERSION}/migrate.linux-$(eval echo ${MIGRATE_ARCH}).tar.gz"
RUN curl -L https://github.com/golang-migrate/migrate/releases/download/${MIGRATE_VERSION}/migrate.linux-$(eval echo ${MIGRATE_ARCH}).tar.gz | tar xvz
# sqlc
RUN go install github.com/sqlc-dev/sqlc/cmd/sqlc@latest
# Move everything into /opt
RUN mv /tmp/migrate /opt
RUN mv /go/bin/buf /opt
RUN mv /go/bin/sqlc /opt
ENV PATH /opt:$PATH
# add an unprivileged user.
RUN useradd unprivileged
WORKDIR /opt/code/liwords