Skip to content
Closed
Show file tree
Hide file tree
Changes from 7 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
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*.bat
Bin
Build
.git
.github
11 changes: 10 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,15 @@ RUN apt-get update && \
VOLUME /build
WORKDIR /build

RUN mkdir -p Client Server Shared utils vendor

COPY Client Client
COPY Server Server
COPY Shared Shared
COPY utils utils
COPY vendor vendor
COPY ./* .

Comment on lines +24 to +32
Copy link
Member

@TheNormalnij TheNormalnij Oct 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should use -v parameter in docker run to mount these folders into a container

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How would it work?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should mount mta repository (or an empty folder) to /build folder in a container. docker-entrypoint.sh runs inside this folder.

# Copy entrypoint script
COPY utils/docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh
Expand All @@ -29,4 +38,4 @@ RUN chmod +x /docker-entrypoint.sh
COPY utils/compat /compat

# Set entrypoint
ENTRYPOINT bash /docker-entrypoint.sh
ENTRYPOINT bash /docker-entrypoint.sh
9 changes: 9 additions & 0 deletions docker-build.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
@echo off

set NAME=mtasa

docker build . -t "%NAME%"
for /f "delims=" %%i in ('docker images -q %NAME%') do set ID=%%i

echo.
echo ID: %ID%
9 changes: 9 additions & 0 deletions docker-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

NAME="mtasa"

docker build . -t $NAME
ID = $(docker images -q $NAME)

echo ""
echo "ID: $ID"
5 changes: 0 additions & 5 deletions utils/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,6 @@ if [[ $AS_BUILDAGENT = "1" ]]; then
fi

# Manually invoke build process
# So, first make a shallow clone of the repository if it not exists
umask 000
if [ ! -f ./premake5.lua ]; then
git clone --depth=1 https://github.com/multitheftauto/mtasa-blue.git .
fi
Comment on lines -24 to -28
Copy link
Member

@TheNormalnij TheNormalnij Oct 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why? Nothing is wrong here. This line allows you to build MTA without cloning the MTA repository.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this line actually clones the entire repo all the time.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't. Check your command line and current folder

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does. Docker pulls mta repo from github if that line is saved. Without it, it runs only local changes

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. I tested it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Me too. It didnt accept local copy unless I remove that line.
If you try to build mta then you already have necessary files in your filesystem.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cd <mta sa repo here>
docker build -t mtasabuilder:latest .
docker run --rm -v ./:/build mtasabuilder:latest

Does it work?

Copy link
Contributor Author

@TracerDS TracerDS Oct 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"volume name is too short, names should be at least two alphanumeric characters."

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

docker run --rm -v <full path to repo>:/build mtasabuilder:latest

?


# Start manual building
export GLIBC_COMPAT=true
Expand Down