정민우

[Add] dockerfile Admin 추가

...@@ -170,7 +170,31 @@ exports.adminListDockerfile = async (req, res) => { ...@@ -170,7 +170,31 @@ exports.adminListDockerfile = async (req, res) => {
170 } 170 }
171 } 171 }
172 exports.adminDeleteDockerfile = async (req, res) => { 172 exports.adminDeleteDockerfile = async (req, res) => {
173 + const requiredKey = ['id']
174 + const required = checkRequiredExist(req.body, requiredKey)
175 + if (required) {
176 + logging('dockerfile', 'error', { code: 400, message: 'missingKey:${required}' }, req)
177 + return sendError(res, 400, `missingKey:${required}`)
178 + }
179 + try {
180 + const dockerfileId = req.body.id
181 + let dockerfile = await Dockerfile.findByPk(dockerfileId)
182 + if (!dockerfile) {
183 + logging('dockerfile', 'error', { code: 404, message: 'NoDockerfileFound' }, req)
184 + return sendError(res, 404, 'NoDockerfileFound')
185 + }
173 186
187 + await Dockerfile.destroy({
188 + where: {
189 + id: dockerfile.id
190 + }
191 + })
192 + logging('dockerfile', 'delete', null, req)
193 + return sendResponse(res, true, 201)
194 + } catch (error) {
195 + logging('dockerfile', 'error', { code: 500, message: error.message }, req)
196 + return sendError(res, 500, error.message)
197 + }
174 } 198 }
175 exports.adminListImage = async (req, res) => { 199 exports.adminListImage = async (req, res) => {
176 200
......
1 -var Docker = require('dockerode')
2 -var docker = new Docker({socketPath: '/var/run/docker.sock'})
3 -
4 -docker.buildImage({
5 - context: '../dockerfiles/sk2jsif92jajsdi1',
6 - src: ['Dockerfile']
7 - }, {t: 'testimage1337'}, function (err, response) {
8 - console.log(response)
9 -})