2024-05-31 16:47:02 +00:00
|
|
|
# Start from the official Go image based on Alpine
|
2024-06-27 14:25:09 +00:00
|
|
|
FROM golang:1.22.4-alpine
|
2024-05-31 16:47:02 +00:00
|
|
|
|
|
|
|
LABEL Description="Trac2Gitea migration tool"
|
|
|
|
|
2024-06-27 14:25:09 +00:00
|
|
|
RUN apk --no-cache add gcc git libc-dev make
|
2024-05-31 16:47:02 +00:00
|
|
|
|
|
|
|
# Parameters for default user:group
|
|
|
|
ARG uid=1000
|
|
|
|
ARG user=appuser
|
|
|
|
ARG gid=1000
|
|
|
|
ARG group=appgroup
|
|
|
|
|
|
|
|
# Add user and group for build and runtime
|
|
|
|
RUN id ${user} > /dev/null 2>&1 || \
|
|
|
|
{ addgroup -g "${gid}" "${group}" && adduser -D -h /home/${user} -s /bin/bash -G "${group}" -u "${uid}" "${user}"; }
|
|
|
|
|
|
|
|
# Prepare directories
|
|
|
|
RUN DIRS="/src /app" && \
|
|
|
|
mkdir -p ${DIRS} && \
|
|
|
|
chown -R ${user}:${group} $DIRS
|
|
|
|
|
|
|
|
# Switch to non-root user
|
|
|
|
USER ${user}
|
|
|
|
|
2024-06-27 14:25:09 +00:00
|
|
|
# Install mockgen
|
|
|
|
#RUN go install go.uber.org/mock/mockgen@v0.4.0
|
|
|
|
#RUN ln -s /go /home/${user}/go
|
2024-05-31 16:47:02 +00:00
|
|
|
|
2024-06-27 14:25:09 +00:00
|
|
|
# Install pinned dependencies
|
|
|
|
#COPY go.mod go.sum /src
|
|
|
|
#WORKDIR /src
|
2024-05-31 16:47:02 +00:00
|
|
|
#RUN go mod download && \
|
|
|
|
# go mod verify
|