質問編集履歴

2

本質問のエラー時にgit cloneして利用していたDockerfileコードを追記しました。

2019/06/07 07:45

投稿

barbar
barbar

スコア11

test CHANGED
File without changes
test CHANGED
@@ -44,7 +44,7 @@
44
44
 
45
45
 
46
46
 
47
- nginxのDockerfileです。(ダウンロードしただけの未編集状態)
47
+ nginxのDockerfileです。(ダウンロードしただけの未編集状態)※本質問の次の日にダウンロードした。
48
48
 
49
49
  ```ここに言語を入力
50
50
 
@@ -135,3 +135,91 @@
135
135
 
136
136
 
137
137
  ```
138
+
139
+
140
+
141
+ ↓本質問のエラーが表示された時にgit cloneしていたnginxのDockerfileです(未編集)。
142
+
143
+ ```ここに言語を入力
144
+
145
+ FROM nginx:alpine
146
+
147
+
148
+
149
+ LABEL maintainer="Mahmoud Zalt <mahmoud@zalt.me>"
150
+
151
+
152
+
153
+ COPY nginx.conf /etc/nginx/
154
+
155
+
156
+
157
+ # If you're in China, or you need to change sources, will be set CHANGE_SOURCE to true in .env.
158
+
159
+
160
+
161
+ ARG CHANGE_SOURCE=false
162
+
163
+ RUN if [ ${CHANGE_SOURCE} = true ]; then \
164
+
165
+ # Change application source from dl-cdn.alpinelinux.org to aliyun source
166
+
167
+ sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/' /etc/apk/repositories \
168
+
169
+ ;fi
170
+
171
+
172
+
173
+ RUN apk update \
174
+
175
+ && apk upgrade \
176
+
177
+ && apk --update add logrotate \
178
+
179
+ && apk add --no-cache openssl \
180
+
181
+ && apk add --no-cache bash \
182
+
183
+ && adduser -D -H -u 1000 -s /bin/bash www-data
184
+
185
+
186
+
187
+ ARG PHP_UPSTREAM_CONTAINER=php-fpm
188
+
189
+ ARG PHP_UPSTREAM_PORT=9000
190
+
191
+
192
+
193
+ # Create 'messages' file used from 'logrotate'
194
+
195
+ RUN touch /var/log/messages
196
+
197
+
198
+
199
+ # Copy 'logrotate' config file
200
+
201
+ COPY logrotate/nginx /etc/logrotate.d/
202
+
203
+
204
+
205
+ # Set upstream conf and remove the default conf
206
+
207
+ RUN echo "upstream php-upstream { server ${PHP_UPSTREAM_CONTAINER}:${PHP_UPSTREAM_PORT}; }" > /etc/nginx/conf.d/upstream.conf \
208
+
209
+ && rm /etc/nginx/conf.d/default.conf
210
+
211
+
212
+
213
+ ADD ./startup.sh /opt/startup.sh
214
+
215
+ RUN sed -i 's/\r//g' /opt/startup.sh
216
+
217
+ CMD ["/bin/bash", "/opt/startup.sh"]
218
+
219
+
220
+
221
+ EXPOSE 80 443
222
+
223
+
224
+
225
+ ```

1

nginxのDockerfileコードを追記しました。

2019/06/07 07:45

投稿

barbar
barbar

スコア11

test CHANGED
File without changes
test CHANGED
@@ -39,3 +39,99 @@
39
39
  環境 mac
40
40
 
41
41
  ![イメージ説明](0ac6e7291a88ea7498df9d2e04f6c4f7.png)
42
+
43
+
44
+
45
+
46
+
47
+ nginxのDockerfileです。(ダウンロードしただけの未編集状態)
48
+
49
+ ```ここに言語を入力
50
+
51
+ FROM nginx:alpine
52
+
53
+
54
+
55
+ LABEL maintainer="Mahmoud Zalt <mahmoud@zalt.me>"
56
+
57
+
58
+
59
+ COPY nginx.conf /etc/nginx/
60
+
61
+
62
+
63
+ # If you're in China, or you need to change sources, will be set CHANGE_SOURCE to true in .env.
64
+
65
+
66
+
67
+ ARG CHANGE_SOURCE=false
68
+
69
+ RUN if [ ${CHANGE_SOURCE} = true ]; then \
70
+
71
+ # Change application source from dl-cdn.alpinelinux.org to aliyun source
72
+
73
+ sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/' /etc/apk/repositories \
74
+
75
+ ;fi
76
+
77
+
78
+
79
+ RUN apk update \
80
+
81
+ && apk upgrade \
82
+
83
+ && apk --update add logrotate \
84
+
85
+ && apk add --no-cache openssl \
86
+
87
+ && apk add --no-cache bash
88
+
89
+
90
+
91
+ RUN set -x ; \
92
+
93
+ addgroup -g 82 -S www-data ; \
94
+
95
+ adduser -u 82 -D -S -G www-data www-data && exit 0 ; exit 1
96
+
97
+
98
+
99
+ ARG PHP_UPSTREAM_CONTAINER=php-fpm
100
+
101
+ ARG PHP_UPSTREAM_PORT=9000
102
+
103
+
104
+
105
+ # Create 'messages' file used from 'logrotate'
106
+
107
+ RUN touch /var/log/messages
108
+
109
+
110
+
111
+ # Copy 'logrotate' config file
112
+
113
+ COPY logrotate/nginx /etc/logrotate.d/
114
+
115
+
116
+
117
+ # Set upstream conf and remove the default conf
118
+
119
+ RUN echo "upstream php-upstream { server ${PHP_UPSTREAM_CONTAINER}:${PHP_UPSTREAM_PORT}; }" > /etc/nginx/conf.d/upstream.conf \
120
+
121
+ && rm /etc/nginx/conf.d/default.conf
122
+
123
+
124
+
125
+ ADD ./startup.sh /opt/startup.sh
126
+
127
+ RUN sed -i 's/\r//g' /opt/startup.sh
128
+
129
+ CMD ["/bin/bash", "/opt/startup.sh"]
130
+
131
+
132
+
133
+ EXPOSE 80 443
134
+
135
+
136
+
137
+ ```