Clear default Dockerfile assignments for *PLATFORM
These kept Docker buildx from automatically building for multiple platforms.
This commit is contained in:
parent
5d585bb891
commit
93749be8bf
2 changed files with 10 additions and 8 deletions
10
Dockerfile
10
Dockerfile
|
|
@ -1,10 +1,8 @@
|
||||||
ARG TARGETPLATFORM=linux/amd64
|
# TARGETPLATFORM and BUILDPLATFORM are automatically filled in by Docker buildx.
|
||||||
ARG BUILDPLATFORM=${TARGETPLATFORM}
|
# They should not be set in the global scope manually.
|
||||||
|
|
||||||
FROM --platform=${BUILDPLATFORM} mcr.microsoft.com/dotnet/sdk:6.0 AS builder
|
FROM --platform=${BUILDPLATFORM} mcr.microsoft.com/dotnet/sdk:6.0 AS builder
|
||||||
|
|
||||||
ARG TARGETPLATFORM
|
|
||||||
|
|
||||||
# Copy build context
|
# Copy build context
|
||||||
WORKDIR /TShock
|
WORKDIR /TShock
|
||||||
COPY . ./
|
COPY . ./
|
||||||
|
|
@ -12,6 +10,10 @@ COPY . ./
|
||||||
# Build and package release based on target architecture
|
# Build and package release based on target architecture
|
||||||
RUN dotnet build -v m
|
RUN dotnet build -v m
|
||||||
WORKDIR /TShock/TShockLauncher
|
WORKDIR /TShock/TShockLauncher
|
||||||
|
|
||||||
|
# Make TARGETPLATFORM available to the container.
|
||||||
|
ARG TARGETPLATFORM
|
||||||
|
|
||||||
RUN \
|
RUN \
|
||||||
case "${TARGETPLATFORM}" in \
|
case "${TARGETPLATFORM}" in \
|
||||||
"linux/amd64") export ARCH="linux-x64" \
|
"linux/amd64") export ARCH="linux-x64" \
|
||||||
|
|
|
||||||
|
|
@ -14,15 +14,15 @@ Open ports can also be passed through using `-p <host_port>:<container_port>`.
|
||||||
|
|
||||||
For Example:
|
For Example:
|
||||||
```bash
|
```bash
|
||||||
# Building the image
|
# Building the image using buildx and loading it into docker
|
||||||
docker build -t tshock:linux-amd64 --build-arg TARGETPLATFORM=linux/amd64 .
|
docker buildx build -t tshock:latest --load .
|
||||||
|
|
||||||
# Running the image
|
# Running the image
|
||||||
docker run -p 7777:7777 -p 7878:7878 \
|
docker run -p 7777:7777 -p 7878:7878 \
|
||||||
-v /home/cider/tshock/:/tshock \
|
-v /home/cider/tshock/:/tshock \
|
||||||
-v /home/cider/.local/share/Terraria/Worlds:/worlds \
|
-v /home/cider/.local/share/Terraria/Worlds:/worlds \
|
||||||
-v /home/cider/tshock/plugins:/plugins \
|
-v /home/cider/tshock/plugins:/plugins \
|
||||||
--rm -it tshock:linux-amd64 \
|
--rm -it tshock:latest \
|
||||||
-world /worlds/backflip.wld -motd "OMFG DOCKER"
|
-world /worlds/backflip.wld -motd "OMFG DOCKER"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -33,7 +33,7 @@ Using `docker buildx`, you could build [multi-platform images](https://docs.dock
|
||||||
For Example:
|
For Example:
|
||||||
```bash
|
```bash
|
||||||
# Building the image using buildx and loading it into docker
|
# Building the image using buildx and loading it into docker
|
||||||
sudo docker buildx build -t tshock:linux-arm64 --platform linux/arm64 --load .
|
docker buildx build -t tshock:linux-arm64 --platform linux/arm64 --load .
|
||||||
|
|
||||||
# Running the image
|
# Running the image
|
||||||
docker run -p 7777:7777 -p 7878:7878 \
|
docker run -p 7777:7777 -p 7878:7878 \
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue