forked from na-Itms/trac2gitea
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Docker support to improve reproducibility
Signed-off-by: Benoit Donneaux <[email protected]>
- Loading branch information
Showing
4 changed files
with
77 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
/.gocache | ||
accessor/mock_gitea | ||
accessor/mock_trac | ||
mock_markdown | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Docker compose file to provide a reproducable Go environment | ||
version: '3' | ||
services: | ||
go-shell: | ||
build: | ||
context: docker/go | ||
dockerfile: Dockerfile | ||
args: | ||
user: appuser | ||
group: appgroup | ||
uid: "${_UID:-1000}" | ||
gid: "${_GID:-1000}" | ||
environment: | ||
- GOCACHE=/var/lib/appdata/.gocache | ||
volumes: | ||
- .:/var/lib/appdata | ||
working_dir: /var/lib/appdata | ||
stdin_open: true | ||
tty: true | ||
hostname: go-shell.local | ||
container_name: go-shell.local | ||
network_mode: "bridge" | ||
# Prevents container to hang the host | ||
# Requires `... --compatibility run ...` | ||
deploy: | ||
resources: | ||
limits: | ||
cpus: '1.5' | ||
memory: 512M |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Start from the official Go image based on Alpine | ||
FROM golang:1.19.3-alpine | ||
|
||
LABEL Description="Trac2Gitea migration tool" | ||
|
||
RUN apk --no-cache add gcc git libc-dev make | ||
|
||
# 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} | ||
|
||
# Install mockgen | ||
#RUN go install go.uber.org/mock/[email protected] | ||
#RUN ln -s /go /home/${user}/go | ||
|
||
# Install pinned dependencies | ||
#COPY go.mod go.sum /src | ||
#WORKDIR /src | ||
#RUN go mod download && \ | ||
# go mod verify |