Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 0 additions & 69 deletions Dockerfile

This file was deleted.

71 changes: 0 additions & 71 deletions Dockerfile.rootless

This file was deleted.

1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,7 @@ migrations.sqlite.test: $(GO_SOURCES)
.PHONY: check
check: test

# DNM(Krey): Experiment
.PHONY: install $(TAGS_PREREQ)
install: $(wildcard *.go)
CGO_CFLAGS="$(CGO_CFLAGS)" $(GO) install -v -tags '$(TAGS)' -ldflags '-s -w $(LDFLAGS)'
Expand Down
33 changes: 33 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# FIXME-BLOCKER(Krey): Should be adapted to use `COPY` from container to container once upstream implements it, currently using a volume that is provided to relevant containers to share the content (https://github.com/docker/compose/issues/5523#issuecomment-774392560)

###! Universal `docker-compose.yml` file intended to be used as a reference for configuration and development.

# DNM(Krey): Provide the database ports within a private network available to services without the need to expose ports to the system unless explicitly specified

version: "3"

services:
gitea-service:
container_name: gitea-service
build:
context: .
dockerfile: docker/dockerfiles/gitea.Dockerfile
ports:
- "3000:3000"
command: /srv/gitea/gitea-wrapper
depends_on:
- gitea-mysql-database
gitea-mysql-database:
container_name: gitea-mysql-database
image: mysql:5.7
restart: always
environment:
- MYSQL_ROOT_PASSWORD=gitea
- MYSQL_USER=gitea
- MYSQL_PASSWORD=gitea
- MYSQL_DATABASE=gitea
ports:
- "3306:3306"
volumes:
mysql:
driver: local
6 changes: 3 additions & 3 deletions docker/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Gitea - Docker

Dockerfile is found in root of repository.
Directory dedicated to docker-related pathnames

Docker image can be found on [docker hub](https://hub.docker.com/r/gitea/gitea)
Docker images are also available on the [docker hub](https://hub.docker.com/r/gitea/gitea)

Documentation on using docker image can be found on [Gitea Docs site](https://docs.gitea.io/en-us/install-with-docker/)
Detailed documentation on how to use provided docker images is available on [Gitea Docs site](https://docs.gitea.io/en-us/install-with-docker/)
111 changes: 111 additions & 0 deletions docker/dockerfiles/gitea.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
###! This dockerfile builds and starts a gitea service

FROM golang:1.15-alpine3.13 AS build-env

ARG GOPROXY="direct"

# DNM-INVESTIGATE(Krey): Investigate these tags and optimize their usage
ARG TAGS="sqlite sqlite_unlock_notify bindata timetzdata"

ARG GITEA_VERSION
ARG CGO_EXTRA_CFLAGS

ARG GITEA_BUILDER_BUILD_DEPS="build-base nodejs npm git"

# Install build dependencies
RUN apk --no-cache add $GITEA_BUILDER_BUILD_DEPS

# Setup repo
COPY . "$GOPATH/src/code.gitea.io/gitea"

WORKDIR "$GOPATH/src/code.gitea.io/gitea"

# Checkout version if set
RUN [ -z "$GITEA_VERSION" ] || { make clean-all && git checkout "${GITEA_VERSION}" ;}

# Build the source code
RUN make clean-all build

# DNM-CD(Krey): Implement automatic bumps of the alpine image
FROM alpine:3.13 AS gitea-service

LABEL maintainer="[email protected]"

# File hierarchy
## NOTE-DUP_CODE(Krey): Changes of these values has to be updated in `docker/wrapper/gitea.sh` as well
ARG GITEA_WORKDIR="/srv/gitea"
RUN mkdir -p "$GITEA_WORKDIR"

ARG GITEA_CUSTOMDIR="$GITEA_WORKDIR/custom"
RUN mkdir -p "$GITEA_CUSTOMDIR"

ARG GITEA_TEMPDIR="/var/tmp/gitea"
RUN mkdir -p "$GITEA_TEMPDIR"

ARG GITEA_CONFDIR="$GITEA_CUSTOMDIR/conf"
RUN mkdir -p "$GITEA_CONFDIR"

ARG GITEA_SRCDIR="/go/src/code.gitea.io/gitea"
ARG GITEA_APP_INI="$GITEA_CONFDIR/app.ini"

RUN mkdir -p "$GITEA_WORKDIR"

ARG GITEA_EXECUTABLE="$GITEA_WORKDIR/gitea"

# Permission
ARG GITEA_USER="gitea"
ARG GITEA_USER_ID="1000"
ARG GITEA_USER_HOME="$GITEA_WORKDIR"
ARG GITEA_USER_SHELL="/bin/nologin"
ARG GITEA_GROUP="gitea"
ARG GITEA_GROUP_ID="1000"

# Dependencies
ARG GITEA_RUNTIME_DEPS="git"

# Install runtime dependencies
RUN apk --no-cache add $GITEA_RUNTIME_DEPS

# Create the gitea user
## NOTE(Krey): These are busybox commands so we have to first create group and then the user added to the group
RUN true \
# addgroup [-g GID] [-S] [USER] GROUP
&& addgroup \
# Create a system group
-S \
# Group id
-g "$GITEA_GROUP_ID" \
"$GITEA_GROUP" \
# adduser [OPTIONS] USER [GROUP]
&& adduser \
# Create System user
-S \
# Don't Create home directory
-H \
# Don't assign a password
-D \
# Home directory
-h "$GITEA_USER_HOME" \
# Login shell
-s "$GITEA_USER_SHELL" \
# User id
-u "$GITEA_USER_ID" \
# Group
-G "$GITEA_GROUP" \
"$GITEA_USER"

# Copy the compiled source code in this container for installation
COPY --from=build-env "/go/src/code.gitea.io/gitea" "$GITEA_SRCDIR"

# Get gitea executable in the system
RUN cp "$GITEA_SRCDIR/gitea" "$GITEA_EXECUTABLE"

ARG GITEA_WRAPPER_SCRIPT="$GITEA_WORKDIR/gitea-wrapper"
COPY docker/wrapper/gitea.sh "$GITEA_WRAPPER_SCRIPT"

RUN chown -R "$GITEA_USER:$GITEA_GROUP" "$GITEA_USER_HOME"

USER "$GITEA_USER"

# FIXME(Krey): Expecting '$GITEA_EXECUTABLE/$GITEA_WRAPPER_SCRIPT' to expand here, but it is not available at the CMD scope
CMD [ "/srv/gitea/gitea", "web" ]
19 changes: 0 additions & 19 deletions docker/manifest.rootless.tmpl

This file was deleted.

19 changes: 0 additions & 19 deletions docker/manifest.tmpl

This file was deleted.

15 changes: 0 additions & 15 deletions docker/root/etc/nsswitch.conf

This file was deleted.

2 changes: 0 additions & 2 deletions docker/root/etc/s6/.s6-svscan/finish

This file was deleted.

2 changes: 0 additions & 2 deletions docker/root/etc/s6/gitea/finish

This file was deleted.

6 changes: 0 additions & 6 deletions docker/root/etc/s6/gitea/run

This file was deleted.

Loading