Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

/usr/bin/easy-add: 7: /usr/bin/easy-add: Syntax error: newline unexpected #5

Closed
Yaimuu opened this issue Jul 1, 2020 · 5 comments
Closed

Comments

@Yaimuu
Copy link

Yaimuu commented Jul 1, 2020

Hello ! I'm new to Dockefiles and I'm trying to use the command you created easy-add in my Dockerfile for a project but I'm getting this error permanently and I'm pretty sure it doesn't come from my code as the error is focusing on the "line 7".
In fact I think that it comes from one of your files.

FROM ubuntu:latest

ARG DEBIAN_FRONTEND=noninteractive

# Applications that will be installed in the docker
RUN apt-get update && \
	apt-get install -y --no-install-recommends \
	vsftpd \
	db-util \
    openssl \
    imagemagick \
    lsof \
    fakeroot build-essential devscripts \
#    shadow \
    bash \
    curl iputils-arping wget \
    git \
    jq \
    mysql-client \
    tzdata \
    apt-transport-https \
    rsync \
    nano && \
    apt-get clean

HEALTHCHECK --start-period=1m CMD mc-monitor status --host localhost --port $SERVER_PORT

RUN groupadd -g 1000 minecraft \
	&& mkdir -m 777 /home/minecraft \
	&& useradd minecraft -s /bin/false -u 1000 -g minecraft -d /home/minecraft \
	&& mkdir -m 777 /data \
	&& chown minecraft:minecraft /data /home/minecraft

EXPOSE 25565 25575

# hook into docker BuildKit --platform support
# see https://docs.docker.com/engine/reference/builder/#automatic-platform-args-in-the-global-scope
ARG TARGETOS=linux
ARG TARGETARCH=amd64
ARG TARGETVARIANT=""

ARG EASY_ADD_VER=0.7.1
ADD https://github.com/itzg/easy-add/releases/tag/${EASY_ADD_VER}/easy-add_${TARGETOS}_${TARGETARCH}${TARGETVARIANT} /usr/bin/easy-add
RUN chmod +x /usr/bin/easy-add

RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} \
	--var version=1.2.0 --var app=restify --file {{.app}} \
	--from https://github.com/itzg/{{.app}}/releases/tag/{{.version}}/{{.app}}_{{.version}}_{{.os}}_{{.arch}}.tar.gz

RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} \
	--var version=1.4.7 --var app=rcon-cli --file {{.app}} \
	--from https://github.com/itzg/{{.app}}/releases/tag/{{.version}}/{{.app}}_{{.version}}_{{.os}}_{{.arch}}.tar.gz

RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} \
	--var version=0.1.7 --var app=mc-monitor --file {{.app}} \
	--from https://github.com/itzg/{{.app}}/releases/tag/{{.version}}/{{.app}}_{{.version}}_{{.os}}_{{.arch}}.tar.gz

RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} \
	--var version=1.4.2 --var app=mc-server-runner --file {{.app}} \
	--from https://github.com/itzg/{{.app}}/releases/tag/{{.version}}/{{.app}}_{{.version}}_{{.os}}_{{.arch}}.tar.gz

RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} \
	--var version=0.1.1 --var app=maven-metadata-release --file {{.app}} \
	--from https://github.com/itzg/{{.app}}/releases/tag/{{.version}}/{{.app}}_{{.version}}_{{.os}}_{{.arch}}.tar.gz

COPY mcstatus /usr/local/bin

VOLUME ["/data"]
COPY server.properties /tmp/server.properties
COPY log4j2.xml /tmp/log4j2.xml
WORKDIR /data

ENTRYPOINT [ "/start" ]

ENV UID=1000 GID=1000 \
  MEMORY="1G" \
  TYPE=VANILLA VERSION=LATEST FORGEVERSION=RECOMMENDED SPONGEBRANCH=STABLE SPONGEVERSION= FABRICVERSION=LATEST LEVEL=world \
  PVP=true DIFFICULTY=easy ENABLE_RCON=true RCON_PORT=25575 RCON_PASSWORD=minecraft \
  LEVEL_TYPE=DEFAULT SERVER_PORT=25565 ONLINE_MODE=TRUE SERVER_NAME="Dedicated Server" \
  REPLACE_ENV_VARIABLES="FALSE" ENV_VARIABLE_PREFIX="CFG_"

COPY start* /
RUN dos2unix /start* && chmod +x /start*

ENV FTP_USER admin
ENV FTP_PASS admin
ENV PASV_ADDRESS REQUIRED

COPY vsftpd.conf /etc/vsftpd/
COPY vsftpd_virtual /etc/pam.d/
COPY run-vsftpd.sh /usr/sbin/

RUN chmod +x /usr/sbin/run-vsftpd.sh && \
        mkdir -p /var/run/vsftpd/empty

VOLUME /home/vsftpd
VOLUME /var/log/vsftpd

EXPOSE 20 21

CMD ["/usr/sbin/run-vsftpd.sh"]

image

I would be very glad if could help me with my issue @itzg

@itzg
Copy link
Owner

itzg commented Jul 1, 2020

easy-add is a binary executable. Add a RUN head /usr/bin/easy-add after the RUN chmod +x /usr/bin/easy-add to see what's going on there.

@Yaimuu
Copy link
Author

Yaimuu commented Jul 2, 2020

I'm getting this :

image

I don't really know what to do with this information...

@itzg
Copy link
Owner

itzg commented Jul 2, 2020

I finally spotted the error in your Dockerfile. You copied this line wrong:

https://github.com/itzg/docker-minecraft-server/blob/9c6047e3fcda7f4d7d6780e6d0e1298a0223d477/Dockerfile#L39

@itzg itzg closed this as completed Jul 2, 2020
@Yaimuu
Copy link
Author

Yaimuu commented Jul 2, 2020

Thanks ! It solved the error but do you know why the line :

RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} \
	--var version=1.2.0 --var app=restify --file {{.app}} \
	--from https://github.com/itzg/{{.app}}/releases/tag/{{.version}}/{{.app}}_{{.version}}_{{.os}}_{{.arch}}.tar.gz

returns a non-zero code ?

@Yaimuu
Copy link
Author

Yaimuu commented Jul 2, 2020

Thanks ! It solved the error but do you know why the line :

RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} \
	--var version=1.2.0 --var app=restify --file {{.app}} \
	--from https://github.com/itzg/{{.app}}/releases/tag/{{.version}}/{{.app}}_{{.version}}_{{.os}}_{{.arch}}.tar.gz

returns a non-zero code ?

Nevermind, I just had to install "ca-certificates" and add "RUN update-ca-certificates" before the line !
Thanks for your help !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants